This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/53154] New: Template class not shadowed by member declaration


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]