re PR c++/71979 (ICE with on C++ code with incorrect type in overloaded base class...
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 22 Sep 2016 15:26:23 +0000 (15:26 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 22 Sep 2016 15:26:23 +0000 (15:26 +0000)
/cp
2016-09-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/71979
* class.c (build_base_path): Allow for lookup_base returning
NULL_TREE.

/testsuite
2016-09-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/71979
* g++.dg/cpp0x/pr71979.C: New.

From-SVN: r240373

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr71979.C [new file with mode: 0644]

index 61d41e739ad4e78f48b1212bf0b77850306fb470..3a4d1f45f8cf5f749b44f9e4bf7151a5ed9f0ce3 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/71979
+       * class.c (build_base_path): Allow for lookup_base returning
+       NULL_TREE.
+
 2016-09-21  Jason Merrill  <jason@redhat.com>
 
        Core 903
index 7362c732646bf6af5f16fcad13d8fcb185de673e..dab163020f41ef26f6f6008501e48b4bad7a7cb7 100644 (file)
@@ -296,12 +296,13 @@ build_base_path (enum tree_code code,
       /* This can happen when adjust_result_of_qualified_name_lookup can't
         find a unique base binfo in a call to a member function.  We
         couldn't give the diagnostic then since we might have been calling
-        a static member function, so we do it now.  */
+        a static member function, so we do it now.  In other cases, eg.
+        during error recovery (c++/71979), we may not have a base at all.  */
       if (complain & tf_error)
        {
          tree base = lookup_base (probe, BINFO_TYPE (d_binfo),
                                   ba_unique, NULL, complain);
-         gcc_assert (base == error_mark_node);
+         gcc_assert (base == error_mark_node || !base);
        }
       return error_mark_node;
     }
index 8adecc03c637da3e54793527328c8e9437aeb55b..6daa92163b7038eceae23fb2904b2d220711262d 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/71979
+       * g++.dg/cpp0x/pr71979.C: New.
+
 2016-09-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        * g++.dg/pr77550.C: Use __SIZE_TYPE__.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71979.C b/gcc/testsuite/g++.dg/cpp0x/pr71979.C
new file mode 100644 (file)
index 0000000..e67eed1
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/71979
+// { dg-do compile { target c++11 } }
+
+struct A
+{ 
+  A & operator= (A &);
+};
+
+struct B : A {};   // { dg-error "cannot bind" }
+
+void foo ()
+{ 
+  B b;
+  b = B ();  // { dg-error "use of deleted" }
+}