From 98c26210e2a36a4b379e4a711d34dda92f076acf Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 26 Feb 2018 15:00:44 +0000 Subject: [PATCH] re PR c++/84533 (ICE with duplicate enum value) /cp 2018-02-26 Paolo Carlini 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 PR c++/84533 * g++.dg/cpp1z/pr84533.C: New. From-SVN: r257991 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp1z/pr84533.C | 3 +++ 4 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/pr84533.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 217bc72ac23..97559ede223 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-02-26 Paolo Carlini + + 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 * lambda.c (build_capture_proxy): Define static. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f91f311a117..cf917731f0c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c16b19f04a..d53ab4d3c8f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-26 Paolo Carlini + + PR c++/84533 + * g++.dg/cpp1z/pr84533.C: New. + 2018-02-26 Marek Polacek 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 index 00000000000..0a71fe1b7de --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/pr84533.C @@ -0,0 +1,3 @@ +// { dg-options "-std=c++17" } + +enum E { e, e }; // { dg-error "redefinition" } -- 2.30.2