Hi,

in this ICE on invalid regression the problem happens toward the end of lookup_destructor when adjust_result_of_qualified_name_lookup (and possibly the callar itself) tries to set BASELINK_QUALIFIED_P of an error_mark_node. As explained in check_dtor_name too, error_mark_node means we already complained about this destructor, thus seems safe to early return it back. Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////
/cp
2014-01-30  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58843
        * typeck.c (lookup_destructor): Check dtor_type for error_mark_node.

/testsuite
2014-01-30  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58843
        * g++.dg/lookup/crash8.C: New.
Index: cp/typeck.c
===================================================================
--- cp/typeck.c (revision 207298)
+++ cp/typeck.c (working copy)
@@ -2486,6 +2486,10 @@ lookup_destructor (tree object, tree scope, tree d
   tree dtor_type = TREE_OPERAND (dtor_name, 0);
   tree expr;
 
+  /* We've already complained about this destructor.  */
+  if (dtor_type == error_mark_node)
+    return error_mark_node;
+
   if (scope && !check_dtor_name (scope, dtor_type))
     {
       if (complain & tf_error)
Index: testsuite/g++.dg/lookup/crash8.C
===================================================================
--- testsuite/g++.dg/lookup/crash8.C    (revision 0)
+++ testsuite/g++.dg/lookup/crash8.C    (working copy)
@@ -0,0 +1,13 @@
+// PR c++/58843
+
+struct A {};
+
+template<typename T> void foo(T t)
+{
+  t.T::~X();  // { dg-error "no type" }
+}
+
+void bar()
+{
+  foo(A());
+}

Reply via email to