Message ID | 224352b4-659b-ee37-fc6b-bfbecda3d7b4@oracle.com |
---|---|
State | New |
Headers | show |
Series | [C++] PR 84533 ("[7/8 Regression] ICE with duplicate enum value") | expand |
OK. On Mon, Feb 26, 2018 at 5:19 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote: > Hi, > > this ICE on invalid happens only in c++17 mode, when > redeclaration_error_message performs an additional check which only makes > sense for data members. Thus the fix is easy: avoid checking > DECL_DECLARED_CONSTEXPR_P on CONST_DECLs. > > Tested x86_64-linux. > > Thanks, Paolo. > > ////////////////////// >
Index: cp/decl.c =================================================================== --- cp/decl.c (revision 257983) +++ cp/decl.c (working copy) @@ -2919,6 +2919,7 @@ redeclaration_error_message (tree newdecl, tree ol 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: testsuite/g++.dg/cpp1z/pr84533.C =================================================================== --- testsuite/g++.dg/cpp1z/pr84533.C (nonexistent) +++ testsuite/g++.dg/cpp1z/pr84533.C (working copy) @@ -0,0 +1,3 @@ +// { dg-options "-std=c++17" } + +enum E { e, e }; // { dg-error "redefinition" }