The following invalid code snippet (compiled with "-std=c++11") triggers an ICE since GCC 4.7.0: ============================= struct A { template<typename> A(); }; constexpr A a; ============================= bug.cc:6:13: error: the type 'const A' of constexpr variable 'a' is not literal constexpr A a; ^ bug.cc:1:8: note: 'A' is not literal because: struct A ^ bug.cc:1:8: note: 'A' is not an aggregate, does not have a trivial default constructor, and has no constexpr constructor that is not a copy or move constructor bug.cc:6:13: internal compiler error: tree check: expected function_decl, have template_decl in explain_non_literal_class, at cp/class.c:5327 constexpr A a; ^ 0xcd83ea tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/gcc/tree.c:9176 0x5f099c tree_check ../../gcc/gcc/tree.h:2609 0x5f099c explain_non_literal_class(tree_node*) ../../gcc/gcc/cp/class.c:5327 0x6bf46b ensure_literal_type_for_constexpr_object(tree_node*) ../../gcc/gcc/cp/semantics.c:5814 0x5696fb cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc/gcc/cp/decl.c:6157 0x65119f cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:16568 0x6518bf cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:10986 0x653740 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:10867 0x65c76e cp_parser_declaration ../../gcc/gcc/cp/parser.c:10764 0x65b4da cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:10650 0x65cda6 cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:3939 0x65cda6 c_parse_file() ../../gcc/gcc/cp/parser.c:28900 0x7707e3 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1046 Please submit a full bug report, [etc.]
Mine.
Author: paolo Date: Fri Feb 28 20:20:21 2014 New Revision: 208226 URL: http://gcc.gnu.org/viewcvs?rev=208226&root=gcc&view=rev Log: /cp 2014-02-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58610 * cp-tree.h (DECL_DELETED_FN): Use LANG_DECL_FN_CHECK. * call.c (print_z_candidate): Remove STRIP_TEMPLATE use. * lambda.c (maybe_add_lambda_conv_op): Likewise. /testsuite 2014-02-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58610 * g++.dg/cpp0x/constexpr-ice11.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-ice11.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/cp/cp-tree.h trunk/gcc/cp/lambda.c trunk/gcc/testsuite/ChangeLog
Fixed for 4.9.0.