[opensuse-packaging] Patching for new GCC
In an old code I have encountered the following error: map.cpp:195:1: error: 'Map::Map' names the constructor, not the type The code is as follows: Map::Map & Map::operator = (Map const & map) { delete[] m_pieces; init(map); return *this; } I tried to remove the "::Map" but this did not help. Any ideas what should I do? -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Thu, Feb 9, 2012 at 1:27 PM, Ilya Chernykh
In an old code I have encountered the following error:
map.cpp:195:1: error: 'Map::Map' names the constructor, not the type
The code is as follows:
Map::Map & Map::operator = (Map const & map) { delete[] m_pieces; init(map);
return *this; }
I tried to remove the "::Map" but this did not help. Any ideas what should I do?
Did you try typename Map::Map ? (in any case, we need context, or we're guessing) -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Thursday 09 February 2012 21:37:06 Claudio Freire wrote:
In an old code I have encountered the following error:
map.cpp:195:1: error: 'Map::Map' names the constructor, not the type
The code is as follows:
Map::Map & Map::operator = (Map const & map) { delete[] m_pieces; init(map);
return *this; }
I tried to remove the "::Map" but this did not help. Any ideas what should I do?
Did you try typename Map::Map ?
(in any case, we need context, or we're guessing)
Then it says error: expected initializer before '&' token -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 02/09/2012 01:44 PM, Ilya Chernykh wrote:
On Thursday 09 February 2012 21:37:06 Claudio Freire wrote:
In an old code I have encountered the following error:
map.cpp:195:1: error: 'Map::Map' names the constructor, not the type
The code is as follows:
Map::Map& Map::operator = (Map const& map) { delete[] m_pieces; init(map);
return *this; }
I tried to remove the "::Map" but this did not help. Any ideas what should I do?
Did you try typename Map::Map ?
(in any case, we need context, or we're guessing)
Then it says
error: expected initializer before '&' token
Ilya, What part of: "We are guessing because there is not enough information" is difficult to understand? You need to post more information if you want help that leads to a solution.
-- Robert Schweikert MAY THE SOURCE BE WITH YOU SUSE-IBM Software Integration Center LINUX Tech Lead rjschwei@suse.com rschweik@ca.ibm.com 781-464-8147 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Thursday 09 February 2012 23:57:46 Robert Schweikert wrote:
In an old code I have encountered the following error:
map.cpp:195:1: error: 'Map::Map' names the constructor, not the type
The code is as follows:
Map::Map& Map::operator = (Map const& map) { delete[] m_pieces; init(map);
return *this; }
I tried to remove the "::Map" but this did not help. Any ideas what should I do?
Did you try typename Map::Map ?
(in any case, we need context, or we're guessing)
Then it says
error: expected initializer before '&' token
Ilya,
What part of:
"We are guessing because there is not enough information"
is difficult to understand?
You need to post more information if you want help that leads to a solution.
As you willing to help, I have attached the whole source. The problem is in file src/map.cpp
On Thu, Feb 9, 2012 at 5:56 PM, Ilya Chernykh
As you willing to help, I have attached the whole source. The problem is in file src/map.cpp
It definitely *should* be: Map & Map::operator = (Map const & map) -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Dnia 2012-02-09, czw o godzinie 20:27 +0400, Ilya Chernykh pisze:
In an old code I have encountered the following error:
map.cpp:195:1: error: 'Map::Map' names the constructor, not the type
The code is as follows:
Map::Map & Map::operator = (Map const & map) { delete[] m_pieces; init(map);
return *this; }
I tried to remove the "::Map" but this did not help. Any ideas what should I do?
It should be "Map & Map::operator = (Map const & map)". Are you sure you tried exactly this? If not sure try again. Remembre to save the file after editing ;) See also: http://www.parashift.com/c++-faq/assignment-operators.html -- Adam Mizerski
On Thursday 09 February 2012 21:56:53 Adam Mizerski wrote:
In an old code I have encountered the following error:
map.cpp:195:1: error: 'Map::Map' names the constructor, not the type
The code is as follows:
Map::Map & Map::operator = (Map const & map) { delete[] m_pieces; init(map);
return *this; }
I tried to remove the "::Map" but this did not help. Any ideas what should I do?
It should be "Map & Map::operator = (Map const & map)". Are you sure you tried exactly this? If not sure try again. Remembre to save the file after editing ;) See also: http://www.parashift.com/c++-faq/assignment-operators.html
Yes, I tried this and other variants: Map & Map::operator = (Map const & map) Map::operator = (Map const & map) Map::Map &::operator = (Map const & map) Map &::operator = (Map const & map) -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 02/09/2012 12:56 PM, Adam Mizerski wrote:
Dnia 2012-02-09, czw o godzinie 20:27 +0400, Ilya Chernykh pisze:
In an old code I have encountered the following error:
map.cpp:195:1: error: 'Map::Map' names the constructor, not the type
The code is as follows:
Map::Map& Map::operator = (Map const& map) { delete[] m_pieces; init(map);
return *this; }
I tried to remove the "::Map" but this did not help. Any ideas what should I do?
It should be "Map& Map::operator = (Map const& map)".
That's not necessarily correct, we do not know whether Map lives in the Map namespace or not and if there are any using declarations or not. Map::Map could be perfectly valid if Map lives in the Map namespace, and there's no namespace declaration in this file. In that case typname as suggested by Claudio should disambiguate things. In any event without more info we are all just guessing.
Are you sure you tried exactly this? If not sure try again. Remembre to save the file after editing ;)
+1
See also: http://www.parashift.com/c++-faq/assignment-operators.html
-- Robert Schweikert MAY THE SOURCE BE WITH YOU SUSE-IBM Software Integration Center LINUX Tech Lead rjschwei@suse.com rschweik@ca.ibm.com 781-464-8147 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (4)
-
Adam Mizerski
-
Claudio Freire
-
Ilya Chernykh
-
Robert Schweikert