https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83271

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That diagnostics is emitted from the attribute handling, before the decls is
merged with the previous extern const int x; decl, so it indeed isn't
TREE_PUBLIC.
So, this doesn't really look easy to fix, we'd need to postpone the weak
attribute processing until later, or look up from the attribute handling code
in the FE whether it has been defined already during the attribute processing,
or temporarily set TREE_PUBLIC bits on the constants around the generic
processing and then make sure to call it again once we can finalize it if it
isn't TREE_PUBLIC but is DECL_WEAK.

I must say I fail to see usefulness of adding the attribute to the definition
rather than declaration though.

Reply via email to