Discussion:
gcc-4.7 and diclaration
Ilya Chernykh
2012-05-02 04:50:55 UTC
Permalink
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<class _T1, class _T2> 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.
--
To unsubscribe, e-mail: opensuse-packaging+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Claudio Freire
2012-05-02 05:01:04 UTC
Permalink
Post by 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,
/usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template<class _T1, class _T2> 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+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Raymond Wooninck
2012-05-02 09:57:55 UTC
Permalink
Hi Ilya,
Post by 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,
/usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template<class _T1, class _T2> 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+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Claudio Freire
2012-05-02 14:06:17 UTC
Permalink
Post by Raymond Wooninck
Post by 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,
/usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template<class _T1,
class _T2> 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<class _T1,
class _T2> std::pair<_T1, _T2> std::make_pair(_T1, _T2)' declared
here, later in the translation unit

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.
--
To unsubscribe, e-mail: opensuse-packaging+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Philipp Thomas
2012-05-02 15:44:57 UTC
Permalink
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+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Cristian Rodríguez
2012-05-02 19:44:20 UTC
Permalink
Post by Claudio Freire
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+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Claudio Freire
2012-05-02 19:59:41 UTC
Permalink
On Wed, May 2, 2012 at 4:44 PM, Cristian Rodríguez
Post by Cristian Rodríguez
Post by Claudio Freire
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+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Philipp Thomas
2012-05-03 10:57:55 UTC
Permalink
Post by Claudio Freire
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+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Claudio Freire
2012-05-03 14:02:44 UTC
Permalink
Post by Philipp Thomas
Post by Claudio Freire
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+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Philipp Thomas
2012-05-02 11:35:39 UTC
Permalink
Post by 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,
/usr/include/c++/4.7/bits/stl_pair.h:284:5: note: 'template<class _T1, class _T2> 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+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Philipp Thomas
2012-05-02 12:48:44 UTC
Permalink
Post by Philipp Thomas
I'll do a service request in a few minutes.
sr 116258

Philipp
--
To unsubscribe, e-mail: opensuse-packaging+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Ilya Chernykh
2012-05-02 16:29:19 UTC
Permalink
Post by Philipp Thomas
Post by Philipp Thomas
I'll do a service request in a few minutes.
sr 116258
Thanks!
--
To unsubscribe, e-mail: opensuse-packaging+***@opensuse.org
To contact the owner, e-mail: opensuse-packaging+***@opensuse.org
Loading...