This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53154] New: Template class not shadowed by member declaration
- From: "amonakov at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 28 Apr 2012 11:29:09 +0000
- Subject: [Bug c++/53154] New: Template class not shadowed by member declaration
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53154
Bug #: 53154
Summary: Template class not shadowed by member declaration
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: amonakov@gcc.gnu.org
The following code is unexpectedly accepted without any warning:
template<int> struct foo {static const int bar=1;};
struct baz {static const int foo=foo<0>::bar;};
When foo is not template, GCC diagnoses the shadowing as expected:
struct foo {static const int bar=1;};
struct baz {static const int foo=foo::bar;};
<stdin>:2:39: error: declaration of âconst int baz::fooâ [-fpermissive]
<stdin>:1:8: error: changes meaning of âfooâ from âstruct fooâ [-fpermissive]
4.5, 4.6, 4.7 and trunk behave the same.