https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67550
--- Comment #6 from Jason Wyatt <jwyatt at feralinteractive dot com> ---
Adding a TREE_READONLY (to match TREE_READONLY being unset in
split_nonconstant_init) check seems to fix the generated gimple. This is total
guesswork though - I have no idea what side effects this change might have.
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index ac11224..ee0405d 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2038,7 +2038,8 @@ constant_value_1 (tree decl, bool strict_p, bool
return_aggregate_cst_ok_p)
|| (strict_p
? decl_constant_var_p (decl)
: (VAR_P (decl)
- && CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl)))))
+ && CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl))
+ && TREE_READONLY (decl))))
{
tree init;
/* If DECL is a static data member in a template