------- Additional Comments From llib at computer dot org 2005-05-02 05:46
-------
the following code is fairly similar to this bug, but it is rejected by g++
4.0.0:
x.cc:10: error: '(Arg1 + 1)' is not a valid template argument for type 'int'
because it is a non-constant expression
x.cc:10: error: 'value' is not a member of '<declaration error>'
is it a new bug? (accepted by comeau c++)
(NoBug1 and NoBug2 are workarounds)
"""
template <int x> struct Id {
enum { value = x };
};
template <int Arg1>
struct Bug {
enum Spam {
enum1 = Arg1,
enum2 = enum1+1,
enum3 = Id<enum2>::value
};
};
template <int Arg1>
struct NoBug1 {
enum {
enum1 = Arg1,
enum2 = Arg1+1,
enum3 = Id<enum2>::value
};
};
template <int Arg1>
struct NoBug2 {
enum {
enum1 = Arg1,
enum2 = enum1+1
};
enum {
enum3 = Id<enum2>::value
};
};
"""
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15877