[Bug c++/34406] New: [reject valid?] incomplete type 'Y' used in nested name specifier.

pluto at agmk dot net gcc-bugzilla@gcc.gnu.org
Sun Dec 9 13:11:00 GMT 2007


template < typename T, typename C, C T::*F >
struct X
{
};

struct Y
{
        typedef X< Y, int, &Y::field_ > Z;
        int field_;
};

gcc-4.1 reports:
t.cpp:8: error: incomplete type 'Y' used in nested name specifier
t.cpp:8: error: template argument 3 is invalid

comeau online:
"ComeauTest.c", line 8: error: class "Y" has no member "field_"
        typedef X< Y, int, &Y::field_ > Z;

msvc8:
t.cpp(8) : error C2065: 'field_' : undeclared identifier

after moving the 'int field_' before typedef:
gcc and comeau accepts code, while msvc8 still rejects with:

t.cpp(9) : error C2327: 'Y::field_' : is not a type name, static, or enumerator
t.cpp(9) : error C2065: 'field_' : undeclared identifier

could someone throw some light please?


-- 
           Summary: [reject valid?] incomplete type 'Y' used in nested name
                    specifier.
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net


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



More information about the Gcc-bugs mailing list