http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58843
Bug ID: 58843 Summary: [4.7/4.8/4.9 Regression] ICE with broken destructor call 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 triggers an ICE since GCC 4.5.0: ======================================== struct A {}; template<typename T> void foo(T t) { t.T::~X(); } void bar() { foo(A()); } ======================================== bug.cc: In instantiation of 'void foo(T) [with T = A]': bug.cc:10:10: required from here bug.cc:5:3: error: no type named 'X' in 'struct A' t.T::~X(); ^ bug.cc:5:3: internal compiler error: Segmentation fault 0xa93d0f crash_signal ../../gcc-4.8.0/gcc/toplev.c:332 0x67f714 adjust_result_of_qualified_name_lookup(tree_node*, tree_node*, tree_node*) ../../gcc-4.8.0/gcc/cp/search.c:1531 0x657186 lookup_destructor ../../gcc-4.8.0/gcc/cp/typeck.c:2494 0x657186 finish_class_member_access_expr(tree_node*, tree_node*, bool, int) ../../gcc-4.8.0/gcc/cp/typeck.c:2704 0x577e1b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc-4.8.0/gcc/cp/pt.c:14260 0x577621 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc-4.8.0/gcc/cp/pt.c:13887 0x57f8ff tsubst_expr ../../gcc-4.8.0/gcc/cp/pt.c:13337 0x57fe5f tsubst_expr ../../gcc-4.8.0/gcc/cp/pt.c:12816 0x580174 tsubst_expr ../../gcc-4.8.0/gcc/cp/pt.c:12992 0x57dd4b instantiate_decl(tree_node*, int, bool) ../../gcc-4.8.0/gcc/cp/pt.c:18854 0x5b8466 instantiate_pending_templates(int) ../../gcc-4.8.0/gcc/cp/pt.c:18953 0x5f3d7d cp_write_global_declarations() ../../gcc-4.8.0/gcc/cp/decl2.c:4025 Please submit a full bug report, [etc.]