re PR c++/85070 (ICE on C++ code: in lazily_declare_fn, at cp/method.c:2409)
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 24 Sep 2018 17:42:45 +0000 (17:42 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 24 Sep 2018 17:42:45 +0000 (17:42 +0000)
/cp
2018-09-24  Paolo Carlini  <paolo.carlini@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.carlini@oracle.com>

PR c++/85070
* g++.dg/cpp0x/pr85070.C: New.

From-SVN: r264541

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

index 079d1cb8574609021b1348353f5c06f7b07084d0..6d4e93b3a24bf21b332bfaddd44bfd950aa1cf9a 100644 (file)
@@ -1,3 +1,9 @@
+2018-09-24  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/85070
+       * method.c (lazily_declare_fn): During error-recovery add_method
+       may return false.
+
 2018-09-21  Marek Polacek  <polacek@redhat.com>
 
        PR c++/87372 - __func__ constexpr evaluation.
index d75dacb1373d7f8e35b5e264cfdc0d83a304703c..5379b4d3d0944b3a6703b0ed43acefed5c58d53d 100644 (file)
@@ -2421,7 +2421,7 @@ lazily_declare_fn (special_function_kind sfk, tree type)
 
   /* 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 b98b6ebf79b5e7a6044ac88efbafa9686508477c..224317927cec944c201ef249ca223260a0937eda 100644 (file)
@@ -1,3 +1,8 @@
+2018-09-24  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/85070
+       * g++.dg/cpp0x/pr85070.C: New.
+
 2018-09-24  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/82699
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr85070.C b/gcc/testsuite/g++.dg/cpp0x/pr85070.C
new file mode 100644 (file)
index 0000000..c1c5b23
--- /dev/null
@@ -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 };