Commit 59bce4ad by Jason Merrill Committed by Jason Merrill

* decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.

From-SVN: r274932
parent f7cf1751
2019-08-26 Jason Merrill <jason@redhat.com>
* decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
2019-08-26 Marek Polacek <polacek@redhat.com> 2019-08-26 Marek Polacek <polacek@redhat.com>
PR c++/91545 - ICE in constexpr store evaluation. PR c++/91545 - ICE in constexpr store evaluation.
......
...@@ -2204,9 +2204,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -2204,9 +2204,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
SET_DECL_DEPENDENT_INIT_P (newdecl, true); SET_DECL_DEPENDENT_INIT_P (newdecl, true);
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (newdecl) DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (newdecl)
|= DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (olddecl); |= DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (olddecl);
if (DECL_CLASS_SCOPE_P (olddecl)) DECL_DECLARED_CONSTEXPR_P (newdecl)
DECL_DECLARED_CONSTEXPR_P (newdecl) |= DECL_DECLARED_CONSTEXPR_P (olddecl);
|= DECL_DECLARED_CONSTEXPR_P (olddecl);
/* Merge the threadprivate attribute from OLDDECL into NEWDECL. */ /* Merge the threadprivate attribute from OLDDECL into NEWDECL. */
if (DECL_LANG_SPECIFIC (olddecl) if (DECL_LANG_SPECIFIC (olddecl)
......
// { dg-do compile { target c++11 } }
constexpr float pi = 3.14;
extern const float pi;
constexpr float x = pi;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment