[C++] PR 85067 ("[8 Regression] ICE with volatile parameter in defaulted copy-constructor")

Message ID fd991797-777a-3d8e-a534-ca7f2b1279ed@oracle.com
State New
Headers show
Series
  • [C++] PR 85067 ("[8 Regression] ICE with volatile parameter in defaulted copy-constructor")
Related show

Commit Message

Paolo Carlini March 27, 2018, 8:33 a.m.
Hi,

Volker noticed that a tweak I committed back in September, which tidied 
the diagnostic we produce in C++11 mode for the testcase in c++/68754 
causes this error recovery regression. We could try restoring the 
consistency, for example along the lines of the patchlet I posted on the 
audit trail (passes testing) but, for 8.1.0 at least, I propose to 
simply revert that change. Tested x86_64-linux.

Thanks, Paolo.

//////////////////////
/cp
2018-03-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/85067
	* method.c (defaulted_late_check): Partially revert r253321 changes,
	do not early return upon error.

/testsuite
2018-03-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/85067
	* g++.dg/cpp0x/defaulted51.C: New.
	* g++.dg/cpp0x/constexpr-68754.C: Adjust.

Comments

Jason Merrill March 27, 2018, 7:55 p.m. | #1
OK.

On Tue, Mar 27, 2018 at 4:33 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,

>

> Volker noticed that a tweak I committed back in September, which tidied the

> diagnostic we produce in C++11 mode for the testcase in c++/68754 causes

> this error recovery regression. We could try restoring the consistency, for

> example along the lines of the patchlet I posted on the audit trail (passes

> testing) but, for 8.1.0 at least, I propose to simply revert that change.

> Tested x86_64-linux.

>

> Thanks, Paolo.

>

> //////////////////////

>

Patch

Index: cp/method.c
===================================================================
--- cp/method.c	(revision 258870)
+++ cp/method.c	(working copy)
@@ -2189,7 +2189,6 @@  defaulted_late_check (tree fn)
 	     "expected signature", fn);
       inform (DECL_SOURCE_LOCATION (fn),
 	      "expected signature: %qD", implicit_fn);
-      return;
     }
 
   if (DECL_DELETED_FN (implicit_fn))
Index: testsuite/g++.dg/cpp0x/constexpr-68754.C
===================================================================
--- testsuite/g++.dg/cpp0x/constexpr-68754.C	(revision 258870)
+++ testsuite/g++.dg/cpp0x/constexpr-68754.C	(working copy)
@@ -3,5 +3,5 @@ 
 
 struct base { };
 struct derived : base {
-  constexpr derived& operator=(derived const&) = default; // { dg-error "defaulted declaration" "" { target { ! c++14 } } }
+  constexpr derived& operator=(derived const&) = default; // { dg-error "defaulted" "" { target { ! c++14 } } }
 };
Index: testsuite/g++.dg/cpp0x/defaulted51.C
===================================================================
--- testsuite/g++.dg/cpp0x/defaulted51.C	(nonexistent)
+++ testsuite/g++.dg/cpp0x/defaulted51.C	(working copy)
@@ -0,0 +1,15 @@ 
+// PR c++/85067
+// { dg-do compile { target c++11 } }
+
+template<int> struct A
+{
+  A();
+  A(volatile A&) = default;  // { dg-error "defaulted" }
+};
+
+struct B
+{
+  A<0> a;
+};
+
+B b;