https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83271
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Richard Biener from comment #5) > Can't we simply force it public when processing the attribute and let > duplicate-decl complain when merging a previous declaration/definition? We can, even guarded on C++ only (although it is in c-family) and on the cases where this can happen (TREE_READONLY && TREE_STATIC, anything else?). But complain when merging a previous declaration/definition can't be enough, because there might not be the previous declaration/definition at all. So it would need to be finalized somewhere else.