re PR c++/68754 (Explicitly defaulted constexpr assignment operator fails to compile)
authorPaolo Carlini <paolo.carlini@oracle.com>
Sat, 30 Sep 2017 17:00:32 +0000 (17:00 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 30 Sep 2017 17:00:32 +0000 (17:00 +0000)
/cp
2017-09-30  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/68754
* method.c (defaulted_late_check): Early return if the defaulted
declaration does not match the expected signature.

/testsuite
2017-09-30  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/68754
* g++.dg/cpp1y/constexpr-68754.C: Move...
* g++.dg/cpp0x/constexpr-68754.C: ... here, adjust.

From-SVN: r253321

gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-68754.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/constexpr-68754.C [deleted file]

index a9ee9a5eacf383c3933cd8e679549e7cd5e2f16e..4025cb09fb460895b629943f9df25ff9c4f2ac64 100644 (file)
@@ -1,3 +1,9 @@
+2017-09-30  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/68754
+       * method.c (defaulted_late_check): Early return if the defaulted
+       declaration does not match the expected signature.
+
 2017-09-29  Jakub Jelinek  <jakub@redhat.com>
 
        P0683R1 - default member initializers for bit-fields
index b83a6f2d10dd2ba851a4a9225e2f77088baf67b0..7788afba48b265365514e70b3008550c8b4611d6 100644 (file)
@@ -2191,9 +2191,11 @@ defaulted_late_check (tree fn)
       || !compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
                     TYPE_ARG_TYPES (TREE_TYPE (implicit_fn))))
     {
-      error ("defaulted declaration %q+D", fn);
-      error_at (DECL_SOURCE_LOCATION (fn),
-               "does not match expected signature %qD", implicit_fn);
+      error ("defaulted declaration %q+D does not match the "
+            "expected signature", fn);
+      inform (DECL_SOURCE_LOCATION (fn),
+             "expected signature: %qD", implicit_fn);
+      return;
     }
 
   if (DECL_DELETED_FN (implicit_fn))
index ebcfb1b518179f039d5734ccfcb0abfa0ce88ca8..cd4688e7916fbf537c6e78726c6371605a8167c9 100644 (file)
@@ -1,3 +1,9 @@
+2017-09-30  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/68754
+       * g++.dg/cpp1y/constexpr-68754.C: Move...
+       * g++.dg/cpp0x/constexpr-68754.C: ... here, adjust.
+
 2017-09-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/82361
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-68754.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-68754.C
new file mode 100644 (file)
index 0000000..643fa07
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/68754
+// { dg-do compile { target c++11 } }
+
+struct base { };
+struct derived : base {
+  constexpr derived& operator=(derived const&) = default; // { dg-error "defaulted declaration" "" { target { ! c++14 } } }
+};
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-68754.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-68754.C
deleted file mode 100644 (file)
index e72acb1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// PR c++/68754
-// { dg-do compile { target c++14 } }
-
-struct base { };
-struct derived : base {
-  constexpr derived& operator=(derived const&) = default;
-};