[Bug c++/11230] New: Qualified name lookup (as per 3.4.3.1) is broken;
shep at netscape dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 18 00:31:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11230
Summary: Qualified name lookup (as per 3.4.3.1) is broken;
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: shep@netscape.com
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: *
GCC host triplet: *
GCC target triplet: *
In a test app, we define an enumeration that shares a name with an external
namespace. When we specify a member of the external namespace in the namespace
where the enumeration was defined, it attempts to look in the enumeration
instead. 3.4.3.1 states that only classes and namespaces should be looked up
for the name preceding the scope resolution operator.
Correct code that doesn't compile:
#include <iostream>
namespace foo
{
enum myenum{
M=5,
N=6
};
}
namespace M
{
typedef int joe;
}
namespace foo
{
M::joe myvar=5;
/* ^^^^^^ this breaks */
}
int main()
{
std::cout << foo::myvar << std::endl;
return 0 ;
}
It can be MADE correct by preceding the M::joe with ::, to force looking from
the top, but this shouldn't be necessary. This may be related to bug 189, but
that one looks a lot hairier, what with the templates and stuff.
More information about the Gcc-bugs
mailing list