re PR c++/84533 (ICE with duplicate enum value)
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 26 Feb 2018 15:00:44 +0000 (15:00 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 26 Feb 2018 15:00:44 +0000 (15:00 +0000)
/cp
2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/84533
* decl.c (redeclaration_error_message): Don't try to use
DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.

/testsuite
2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/84533
* g++.dg/cpp1z/pr84533.C: New.

From-SVN: r257991

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/pr84533.C [new file with mode: 0644]

index 217bc72ac233ad8eb7b8c8e86d747ced07b6f1a2..97559ede22335fef0c87be1a0aa5671e0793f68d 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/84533
+       * decl.c (redeclaration_error_message): Don't try to use
+       DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.
+
 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * lambda.c (build_capture_proxy): Define static.
index f91f311a117d81a9719c907854a3f2612edabf75..cf917731f0ca65dadb6fd68aa187bf0d109452f0 100644 (file)
@@ -2919,6 +2919,7 @@ redeclaration_error_message (tree newdecl, tree olddecl)
         specifier is declaration rather than definition (and
         deprecated).  */
       if (cxx_dialect >= cxx17
+         && VAR_P (olddecl)
          && DECL_CLASS_SCOPE_P (olddecl)
          && DECL_DECLARED_CONSTEXPR_P (olddecl)
          && !DECL_INITIAL (newdecl))
index 8c16b19f04a6bcff90cbb75c2cacc0c60e0822c9..d53ab4d3c8f2f99e476f667909a867790cb7a3d3 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/84533
+       * g++.dg/cpp1z/pr84533.C: New.
+
 2018-02-26  Marek Polacek  <polacek@redhat.com>
 
        PR c++/84537
diff --git a/gcc/testsuite/g++.dg/cpp1z/pr84533.C b/gcc/testsuite/g++.dg/cpp1z/pr84533.C
new file mode 100644 (file)
index 0000000..0a71fe1
--- /dev/null
@@ -0,0 +1,3 @@
+// { dg-options "-std=c++17" }
+
+enum E { e, e };  // { dg-error "redefinition" }