public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "public at alisdairm dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54875] New: Forward declare enums cannot be used as a template argument Date: Tue, 09 Oct 2012 13:39:00 -0000 [thread overview] Message-ID: <bug-54875-4@http.gcc.gnu.org/bugzilla/> (raw) 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: unassigned@gcc.gnu.org ReportedBy: public@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)
next reply other threads:[~2012-10-09 13:39 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-10-09 13:39 public at alisdairm dot net [this message] 2012-10-09 14:23 ` [Bug c++/54875] " daniel.kruegler at googlemail dot com 2012-10-09 14:38 ` paolo.carlini at oracle dot com 2012-10-26 18:50 ` dodji at gcc dot gnu.org 2012-11-16 12:57 ` dodji at seketeli dot org 2012-11-16 15:20 ` dodji at gcc dot gnu.org 2012-11-16 15:23 ` dodji at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-54875-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).