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

           Summary: Front end issue
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: sla...@codeaurora.org


The following C++ code: 


class C {
public:
    static int N;
    union U {
        int m;
        char k;
    };
    typedef void (*A[3])(int);
} c;

int C::N = 0;
int n = 0;

template <class T> struct S {
    void f(void) { (void) sizeof(typename T::N); }
};
S<C> s;
void g(void) { s.f(); }

Should compile fine per ISO/IEC 14882:2005, 14.6 (Name resolution). It fails
with plain vanilla x86 4.5.1 release:

g++ -v
Using built-in specs.
COLLECT_GCC=.../bin_x86/bin/g++
COLLECT_LTO_WRAPPER=.../bin_x86/libexec/gcc/x86_64-unknown-linux-gnu/4.5.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-threads=posix --prefix=.../bin_x86
--enable-languages=c,c++ --disable-checking
Thread model: posix
gcc version 4.5.1 (GCC)

(any option)

g++ -S test.C 
test.C: In member function 'void S<T>::f() [with T = C]':
test.C:56:   instantiated from here
test.C:53: error: no type named 'N' in 'class C'

Reply via email to