https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71528
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-06-14
Ever confirmed|0 |1
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That said, I believe the bug is not there, but in the FE.
x is initially marked TREE_READONLY, then cp_finish_decl clears the
TREE_READONLY bit:
6782 {
6783 was_readonly = 1;
6784 TREE_READONLY (decl) = 0;
6785 }
because it has an initializer that is invoked at runtime, but then
duplicate_decls sets it again:
2117 /* Merge the type qualifiers. */
2118 if (TREE_READONLY (newdecl))
2119 TREE_READONLY (olddecl) = 1;