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]

More enum/template problems


Jody, thanks for patching that enum problem.  Here's another one
which is eerily similar.  It fails with the 970907 snapshot.

bug27.cpp:31: `a' is not a member of type `Y<X,X,X>'
bug27.cpp:31: enumerator value for `a' not integer constant



template<int N1, int N2>
struct meta_max {
    enum { max = (N1 > N2) ? N1 : N2 };
};

struct X {
    enum { 
       a = 0, 
       n = 0 
    };
};

template<class T1, class T2, class T3>
struct Y {

    enum { 
       a = T1::a + T2::a + T3::a,
       n = meta_max<meta_max<T1::n,T2::n>::max, T3::n>::max
    };
};

template<class T>
struct Z {
    enum { 
       a = T::a,
       n = T::n 
    };
};

Z<Y<X,X,X> > z;



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