Hi,

as explained in the audit trail, the gcc_assert added by Nathan triggers during error-recovery too, when add_method correctly returns false because it failed to add the method. Thus it seems that we should simply loosen a bit the assertion. Tested x86_64-linux.

Thanks, Paolo.

///////////////////

/cp
2018-09-24  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/85070
        * method.c (lazily_declare_fn): During error-recovery add_method
        may return false.

/testsuite
2018-09-24  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/85070
        * g++.dg/cpp0x/pr85070.C: New.
Index: cp/method.c
===================================================================
--- cp/method.c (revision 264524)
+++ cp/method.c (working copy)
@@ -2421,7 +2421,7 @@ lazily_declare_fn (special_function_kind sfk, tree
 
   /* Add it to the class  */
   bool added = add_method (type, fn, false);
-  gcc_assert (added);
+  gcc_assert (added || errorcount);
 
   /* Add it to TYPE_FIELDS.  */
   if (sfk == sfk_destructor
Index: testsuite/g++.dg/cpp0x/pr85070.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr85070.C    (nonexistent)
+++ testsuite/g++.dg/cpp0x/pr85070.C    (working copy)
@@ -0,0 +1,13 @@
+// { dg-do compile { target c++11 } }
+
+struct A;
+
+struct B
+{
+  constexpr A & operator= (const A &);  // { dg-warning "used" "" { target 
c++14_only } }
+};
+
+struct A : B  // { dg-error "cannot be overloaded" "" { target c++14_only } }
+{
+  using B::operator=;
+} a { a = a };

Reply via email to