public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50399] New: [c++11] Lookup error w/ enums
@ 2011-09-15 7:06 blelbach at cct dot lsu.edu
2011-09-15 9:26 ` [Bug c++/50399] " redi at gcc dot gnu.org
2011-09-15 9:35 ` redi at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: blelbach at cct dot lsu.edu @ 2011-09-15 7:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50399
Bug #: 50399
Summary: [c++11] Lookup error w/ enums
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: blelbach@cct.lsu.edu
$ cat cxx11_enum_lookup_bug.cpp
namespace A {
namespace B {
void F() { }
}
namespace C {
enum B { };
void G() { B::F(); }
}
}
$ /usr/lib/gcc-snapshot/bin/g++ --version
g++ (Debian 20110816-1) 4.7.0 20110816 (experimental) [trunk revision 177785]
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ /usr/lib/gcc-snapshot/bin/g++ cxx11_enum_lookup_bug.cpp -c
$ /usr/lib/gcc-snapshot/bin/g++ cxx11_enum_lookup_bug.cpp -c -std=c++0x
cxx11_enum_lookup_bug.cpp: In function 'void A::C::G()':
cxx11_enum_lookup_bug.cpp:13:12: error: 'F' is not a member of 'A::C::B'
$ g++-4.6 --version
g++-4.6 (Debian 4.6.1-8) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++-4.6 cxx11_enum_lookup_bug.cpp -c
$ g++-4.6 cxx11_enum_lookup_bug.cpp -c -std=c++0x
cxx11_enum_lookup_bug.cpp: In function ‘void A::C::G()’:
cxx11_enum_lookup_bug.cpp:13:12: error: ‘F’ is not a member of ‘A::C::B’
$ g++-4.5 --version
g++-4.5 (Debian 4.5.3-8) 4.5.3
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++-4.5 cxx11_enum_lookup_bug.cpp -c
$ g++-4.5 cxx11_enum_lookup_bug.cpp -c -std=c++0x
cxx11_enum_lookup_bug.cpp: In function ‘void A::C::G()’:
cxx11_enum_lookup_bug.cpp:13:12: error: ‘F’ is not a member of ‘A::C::B’
$ g++-4.4 --version
g++-4.4 (Debian 4.4.6-8) 4.4.6
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++-4.4 cxx11_enum_lookup_bug.cpp -c
$ g++-4.4 cxx11_enum_lookup_bug.cpp -c -std=c++0x
cxx11_enum_lookup_bug.cpp: In function ‘void A::C::G()’:
cxx11_enum_lookup_bug.cpp:13: error: ‘F’ is not a member of ‘A::C::B’
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/50399] [c++11] Lookup error w/ enums
2011-09-15 7:06 [Bug c++/50399] New: [c++11] Lookup error w/ enums blelbach at cct dot lsu.edu
@ 2011-09-15 9:26 ` redi at gcc dot gnu.org
2011-09-15 9:35 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-15 9:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50399
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-15 09:21:30 UTC ---
I think G++ is correct, see [basic.lookup.qual]
In C++03 a nested-name-specifier can only refer to a class or namespace, in
C++11 it can also refer to an enumeration.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/50399] [c++11] Lookup error w/ enums
2011-09-15 7:06 [Bug c++/50399] New: [c++11] Lookup error w/ enums blelbach at cct dot lsu.edu
2011-09-15 9:26 ` [Bug c++/50399] " redi at gcc dot gnu.org
@ 2011-09-15 9:35 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-15 9:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50399
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-15 09:26:38 UTC ---
C++03 says "During the lookup for a name preceding the :: scope resolution
operator, object, function, and enumerator names are ignored."
So in -std=c++98 mode G++ is correct to ignore A::C::B and so finds B::F (Clang
gets this wrong)
In C++11 the enumeration is not ignored (because a nested-name-specifier could
refer to a scoped enumeration) so name lookup finds B in the enclosing
namespace, i.e. A::C::B
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-15 9:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-15 7:06 [Bug c++/50399] New: [c++11] Lookup error w/ enums blelbach at cct dot lsu.edu
2011-09-15 9:26 ` [Bug c++/50399] " redi at gcc dot gnu.org
2011-09-15 9:35 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).