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]

g++ 3.0.2 template parser too eager to error out



The following program compiles, links and prints 25 when compiled with
Sun WorkShop 6 update 2 C++ 5.3, or with
Edison Design Group C/C++ Front End, version 2.43.1, but fails miserably
when compiled with  gcc version 3.0.2:

template<class T> struct C {
        typedef T qq;
        enum {  ww = 7 };
};

template<> struct C<int> {
        enum { qq = 5 };
        typedef int ww;
};

template<class T> struct D {
        enum { qq = C<T>::qq * 5};
        typedef typename C<T>::ww ww;
};

#include <iostream>
using namespace std;
int main() {
        D<int>::ww x = D<int>::qq;
        cout << x << endl;
        return 0;
}


 


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