http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59637
Bug ID: 59637 Summary: [c++11] ICE with decltype and destructor call in template 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++11") triggers an ICE since GCC 4.7.0: =========================================== template<typename T> void foo(T* p) { p->decltype(T{})::~X(); }; =========================================== bug.cc: In function 'void foo(T*)': bug.cc:3:21: internal compiler error: Segmentation fault p->decltype(T{})::~X(); ^ 0xb75baf crash_signal ../../gcc/gcc/toplev.c:336 0x6785d7 contains_struct_check ../../gcc/gcc/tree.h:2820 0x6785d7 cp_parser_unqualified_id ../../gcc/gcc/cp/parser.c:4926 0x68fd73 cp_parser_id_expression ../../gcc/gcc/cp/parser.c:4726 0x6993e8 cp_parser_postfix_dot_deref_expression ../../gcc/gcc/cp/parser.c:6529 0x67e729 cp_parser_postfix_expression ../../gcc/gcc/cp/parser.c:6186 0x681698 cp_parser_unary_expression ../../gcc/gcc/cp/parser.c:7170 0x68232f cp_parser_binary_expression ../../gcc/gcc/cp/parser.c:7874 0x682821 cp_parser_assignment_expression ../../gcc/gcc/cp/parser.c:8112 0x6847b4 cp_parser_expression ../../gcc/gcc/cp/parser.c:8274 0x684fec cp_parser_expression ../../gcc/gcc/cp/parser.c:8313 0x684fec cp_parser_expression_statement ../../gcc/gcc/cp/parser.c:9617 0x67a818 cp_parser_statement ../../gcc/gcc/cp/parser.c:9468 0x67b5c9 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:9740 0x67b73e cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:9694 0x68f15b cp_parser_function_body ../../gcc/gcc/cp/parser.c:18610 0x68f15b cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:18646 0x6934fe cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:22678 0x694394 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:22590 0x694394 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:16588 Please submit a full bug report, [etc.] The code was wrongly rejected from GCC 4.3.0 (where decltype was introduced) until GCC 4.6.4.