[opensuse-packaging] gcc-4.7 and diclaration
Hi!
I got the following error (https://build.opensuse.org/package/live_build_log?arch=i586&package=kde3-krusader&project=KDE%3AKDE3&repository=openSUSE_Factory):
===
tstring.h:102:3: error: 'make_pair' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
In file included from /usr/include/c++/4.7/utility:72:0,
from /usr/include/c++/4.7/algorithm:61,
from expander.cpp:13:
/usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template
On Wed, May 2, 2012 at 1:50 AM, Ilya Chernykh
tstring.h:102:3: error: 'make_pair' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] In file included from /usr/include/c++/4.7/utility:72:0, from /usr/include/c++/4.7/algorithm:61, from expander.cpp:13: /usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template
std::pair<_T1, _T2> std::make_pair(_T1, _T2)' declared here, later in the translation unit === But file "#include <utility>" (from which stl_pair is included) is included in the very beginning of tstring.h. I wonder why the compiler says it is included later if it is in the very beginning.
Notice that tstring.h, according to the error message, is being included by utility at line 72. I'd call it a bug in gcc's stdlib. Those errors aren't considered by the compiler until you invoke the offending code, so it could explain why it got past gcc's tests. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Hi Ilya, On 05/02/2012 06:50 AM, Ilya Chernykh wrote:
=== tstring.h:102:3: error: 'make_pair' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] In file included from /usr/include/c++/4.7/utility:72:0, from /usr/include/c++/4.7/algorithm:61, from expander.cpp:13: /usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template
std::pair<_T1, _T2> std::make_pair(_T1, _T2)' declared here, later in the translation unit ===
Replace all occurances of "make_pair" with "std:make_pair". This would resolve your issue. Regards Raymond -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Wed, May 2, 2012 at 6:57 AM, Raymond Wooninck
On 05/02/2012 06:50 AM, Ilya Chernykh wrote:
=== tstring.h:102:3: error: 'make_pair' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] In file included from /usr/include/c++/4.7/utility:72:0, from /usr/include/c++/4.7/algorithm:61, from expander.cpp:13: /usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template
std::pair<_T1, _T2> std::make_pair(_T1, _T2)' declared here, later in the translation unit === Replace all occurances of "make_pair" with "std:make_pair". This would resolve your issue.
This got me thinking "how come?", and then I noticed:
The OP had mistakenly copypasted half of one error message and half of another.
In context, the error:
In file included from expander.h:20:0,
from expander.cpp:15:
tstring.h: In instantiation of 'void TagString_t<T>::insertTag(uint,
const T&) [with T = QStringList; uint = unsigned int]':
expander.cpp:797:21: required from here
tstring.h:111:2: error: 'make_pair' was not declared in this scope,
and no declarations were found by argument-dependent lookup at the
point of instantiation [-fpermissive]
Then the clarification:
In file included from /usr/include/c++/4.7/utility:72:0,
from /usr/include/c++/4.7/algorithm:61,
from expander.cpp:13:
/usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template
* Claudio Freire (klaussfreire@gmail.com) [20120502 16:06]:
I wonder, though, how come it worked with earlier GCCs.
I wondered too. but I didn't want to spend time looking at older gcc versions. Philipp -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
El 02/05/12 10:06, Claudio Freire escribió:
And at line tstring.h:111, yes, an unqualified call to make_pair. So the namespace is missing. I wonder, though, how come it worked with earlier GCCs.
See http://gcc.gnu.org/gcc-4.7/changes.html search for "G++ now correctly implements the two-phase lookup rules" ... in the page. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Wed, May 2, 2012 at 4:44 PM, Cristian Rodríguez
And at line tstring.h:111, yes, an unqualified call to make_pair. So the namespace is missing. I wonder, though, how come it worked with earlier GCCs.
See http://gcc.gnu.org/gcc-4.7/changes.html
search for "G++ now correctly implements the two-phase lookup rules" ... in the page.
So... the instantiation in expander.cpp had the using namespace std that made gcc <4.7 find the declaration perhaps? Interesting... -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
* Claudio Freire (klaussfreire@gmail.com) [20120502 21:59]:
So... the instantiation in expander.cpp had the using namespace std that made gcc <4.7 find the declaration perhaps?
Nope, gcc < 4.7 simply did the the second unqualified lookup and found make_pair in namespace std::. No need for a 'using' somewhere else. Philipp -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Thu, May 3, 2012 at 7:57 AM, Philipp Thomas
* Claudio Freire (klaussfreire@gmail.com) [20120502 21:59]:
So... the instantiation in expander.cpp had the using namespace std that made gcc <4.7 find the declaration perhaps?
Nope, gcc < 4.7 simply did the the second unqualified lookup and found make_pair in namespace std::. No need for a 'using' somewhere else.
I never *ever* was on the receiving side of such a "benefit". I've always had to add the "std::" or get an error. I guess we always learn new tricks ;-) Thanks. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
* Ilya Chernykh (anixxsus@gmail.com) [20120502 06:53]:
=== tstring.h:102:3: error: 'make_pair' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] In file included from /usr/include/c++/4.7/utility:72:0, from /usr/include/c++/4.7/algorithm:61, from expander.cpp:13: /usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template
std::pair<_T1, _T2> std::make_pair(_T1, _T2)' declared here, later in the translation unit ===
There are two unqualified calls to make_pair in tstring.h. Changing them to the qualified calls std::make_pair will most probably make the error disappear. I'll do a service request in a few minutes. Philipp -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (5)
-
Claudio Freire
-
Cristian Rodríguez
-
Ilya Chernykh
-
Philipp Thomas
-
Raymond Wooninck