http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58511
Bug ID: 58511 Summary: [c++0x] ICE using static const member variable in constexpr Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org The following invalid code snippet (compiled with "-std=c++0x") triggers an ICE since GCC 4.8.0 (when inheriting constructors were introduced): ==================================== struct A { constexpr A(int, int = i) {} static const int i; }; struct B : A { using A::A; }; constexpr B b(0); ==================================== bug.cc:12:16: error: 'constexpr B::B(int)' called in a constant expression constexpr B b(0); ^ bug.cc:9:12: note: 'constexpr B::B(int)' is not usable as a constexpr function because: using A::A; ^ bug.cc:9:12: internal compiler error: in synthesized_method_walk, at cp/method.c:1218 0x675548 synthesized_method_walk ../../gcc-4.8.0/gcc/cp/method.c:1217 0x679692 explain_implicit_non_constexpr(tree_node*) ../../gcc-4.8.0/gcc/cp/method.c:1481 0x69f68b explain_invalid_constexpr_fn(tree_node*) ../../gcc-4.8.0/gcc/cp/semantics.c:6379 0x69faf6 cxx_eval_call_expression ../../gcc-4.8.0/gcc/cp/semantics.c:6751 0x6a1142 cxx_eval_constant_expression ../../gcc-4.8.0/gcc/cp/semantics.c:7814 0x6a14a9 cxx_eval_constant_expression ../../gcc-4.8.0/gcc/cp/semantics.c:7835 0x6a4426 cxx_eval_outermost_constant_expr ../../gcc-4.8.0/gcc/cp/semantics.c:8115 0x5bd69d store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc-4.8.0/gcc/cp/typeck2.c:722 0x540b40 check_initializer ../../gcc-4.8.0/gcc/cp/decl.c:5711 0x5537b5 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc-4.8.0/gcc/cp/decl.c:6328 0x62afeb cp_parser_init_declarator ../../gcc-4.8.0/gcc/cp/parser.c:16038 0x62b85e cp_parser_simple_declaration ../../gcc-4.8.0/gcc/cp/parser.c:10567 0x62d630 cp_parser_block_declaration ../../gcc-4.8.0/gcc/cp/parser.c:10448 0x6361fb cp_parser_declaration ../../gcc-4.8.0/gcc/cp/parser.c:10345 0x634ecd cp_parser_declaration_seq_opt ../../gcc-4.8.0/gcc/cp/parser.c:10231 0x636772 cp_parser_translation_unit ../../gcc-4.8.0/gcc/cp/parser.c:3807 0x636772 c_parse_file() ../../gcc-4.8.0/gcc/cp/parser.c:28186 0x73e504 c_common_parse_file() ../../gcc-4.8.0/gcc/c-family/c-opts.c:1046 Please submit a full bug report, [etc.]