http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54875
Bug #: 54875 Summary: Forward declare enums cannot be used as a template argument Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: pub...@alisdairm.net The following simple code snippet shows the problem: template<typename T> using AddConst = T const; enum FwdEnum : int; int main() { AddConst<FwdEnum> *ptr = nullptr; } Trying to instantiate the alias template, in this case to declare a pointer but the problem is more general, produces an internal compiler error. The problem is probably older than the gcc 4.8 I am testing with, but it does give a nice assertion from the compiler: main.cpp: In function 'int main()': main.cpp:7:20: internal compiler error: tree check: expected enumeral_type, have template_type_parm in tsubst_enum, at cp/pt.c:18923 AddConst<FwdEnum> *ptr = nullptr; ^ main.cpp:7:20: internal compiler error: Abort trap: 6 g++-mp-4.8: internal compiler error: Abort trap: 6 (program cc1plus) Abort trap: 6 Version info of the compiler I am testing with: gcc -v -save-temps -std=c++11 Using built-in specs. Target: i686-apple-darwin11 Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)