http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58647
Bug ID: 58647 Summary: [4.7/4.8/4.9 Regression] ICE with function pointer 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 valid code snippet triggers an ICE since GCC 4.7.0 only if compiled with "-std=c++11". Without this option the code compiles fine. ====================================== struct A { static void foo(); }; template<typename> void bar() { A().foo; } ====================================== bug.cc: In function 'void bar()': bug.cc:8:10: internal compiler error: tree check: expected tree that contains 'decl common' structure, have 'baselink' in cxx_eval_component_reference, at cp/semantics.c:7145 A().foo; ^ 0xcd96a7 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc/gcc/tree.c:9348 0x6c55d9 contains_struct_check ../../gcc/gcc/tree.h:2723 0x6c55d9 cxx_eval_component_reference ../../gcc/gcc/cp/semantics.c:7145 0x6c55d9 cxx_eval_constant_expression ../../gcc/gcc/cp/semantics.c:8094 0x6c7036 cxx_eval_outermost_constant_expr ../../gcc/gcc/cp/semantics.c:8217 0x6c9cab maybe_constant_value(tree_node*) ../../gcc/gcc/cp/semantics.c:8327 0x59da21 build_non_dependent_expr(tree_node*) ../../gcc/gcc/cp/pt.c:20960 0x6acbf0 finish_expr_stmt(tree_node*) ../../gcc/gcc/cp/semantics.c:627 0x63d167 cp_parser_statement ../../gcc/gcc/cp/parser.c:9280 0x63e452 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:9552 0x63e596 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:9506 0x64f95b cp_parser_function_body ../../gcc/gcc/cp/parser.c:18328 0x64f95b cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:18364 0x6509af cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:22351 0x6516d5 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:22272 0x6516d5 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:16357 0x651fd4 cp_parser_single_declaration ../../gcc/gcc/cp/parser.c:22665 0x654be8 cp_parser_template_declaration_after_export ../../gcc/gcc/cp/parser.c:22467 0x65c9d9 cp_parser_declaration ../../gcc/gcc/cp/parser.c:10737 0x65b5aa cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:10659 Please submit a full bug report, [etc.]