Here we go: [EMAIL PROTECTED]:~> cat foo.cpp template <typename FOO> struct bar { enum { MASK = ((1 << 17)-1) , IT_MASK = (~MASK) , ITERATION_INC = (MASK+1) }; };
int baz = bar<int>::IT_MASK; [EMAIL PROTECTED]:~> g++ -o /dev/null -c foo.cpp foo.cpp: In instantiation of `bar<int>': foo.cpp:10: instantiated from here foo.cpp:3: error: enumerator value for `IT_MASK' not integer constant [EMAIL PROTECTED]:~> gcc -v Reading specs from /openpkg/lib/gcc/i686-pc-linux-gnu/3.4.2/specs Configured with: ../configure --cache-file=./config.cache --srcdir=/openpkg/RPM/TMP/gcc-3.4.2/obj/.. --prefix=/openpkg --exec-prefix=/openpkg --includedir=/openpkg/include/gcc --libexecdir=/openpkg/libexec/gcc --with-gxx-include-dir=/openpkg/include/g++ --with-local-prefix=/openpkg/lib/gcc --enable-languages=c,c++ --enable-threads=posix --disable-maintainer-mode --disable-shared --disable-nls --with-gnu-ld --with-ld=/openpkg/bin/ld --with-gnu-as --with-as=/openpkg/bin/as Thread model: posix gcc version 3.4.2 (OpenPKG-CURRENT) [EMAIL PROTECTED]:~> uname -a Linux linux 2.4.21-99-smp4G #1 SMP Wed Sep 24 14:13:20 UTC 2003 i686 athlon i386 GNU/Linux This is a Suse 9.0 with gcc from CURRENT OpenPKG. It works if you remove the template declaration. -- Summary: issue with enum in a template Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gmorin1 at bloomberg dot net CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18020