[patch c++]: Fix PR/64100 'A static assert using the the current class in a noexcept test leads to a segfault'

Kai Tietz ktietz70@googlemail.com
Thu Dec 4 15:00:00 GMT 2014


Hi,

 The issue is that lookup_destructor calls
adjust_result_of_qualified_name_lookup
with an NULL_TREE decl (returned by lookup_member).  So error-message
is missing.

As already discussed in bug-tracker:

ChangeLog

2014-12-04  Kai Tietz  <ktietz@redhat.com>

    PR c++/64100
    * typeck.c (lookup_destructor): Handle incomplete
    type.

Tested on x86_64-unknown-linux-gnu.

Ok for apply?

Kai
Index: typeck.c
===================================================================
--- typeck.c    (Revision 218309)
+++ typeck.c    (Arbeitskopie)
@@ -2536,6 +2535,12 @@ lookup_destructor (tree object, tree scope, tree d
   expr = lookup_member (dtor_type, complete_dtor_identifier,
             /*protect=*/1, /*want_type=*/false,
             tf_warning_or_error);
+  if (!expr)
+    {
+      if (complain & tf_error)
+    cxx_incomplete_type_error (dtor_name, dtor_type);
+      return error_mark_node;
+    }
   expr = (adjust_result_of_qualified_name_lookup
       (expr, dtor_type, object_type));
   if (scope == NULL_TREE)



More information about the Gcc-patches mailing list