[Bug c++/50418] New: nested class typedef with same name and pointing to parent class typedef

frrrwww at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Sep 15 09:05:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50418

             Bug #: 50418
           Summary: nested class typedef with same name and pointing to
                    parent class typedef
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: frrrwww@gmail.com


struct A
{
    typedef int T;
    struct B
    {
        typedef T T;
    };
};

test.cpp:6:19: error: declaration of ‘typedef A::T A::B::T’
test.cpp:3:17: error: changes meaning of ‘T’ from ‘typedef int A::T’

It works with Comeau, Clang and VC++, gcc workaround is the following:

struct A
{
    typedef int T;
    struct B
    {
        typedef A::T T;
    };
};



More information about the Gcc-bugs mailing list