https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119666
--- Comment #2 from Artem Labazov <123321artyom at gmail dot com> --- (In reply to Jakub Jelinek from comment #1) > I think the GCC behavior is correct here, in C++ const has special meaning > and even attribute like weak shouldn't change that. Perhaps, a more idiomatic C++ code that fulfills my needs would be const int my_number [[gnu::weak]] = 4; This code should be ODR-safe, but it is rejected by GCC due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83271 Still, if the current behaviour of extern const weak symbols is considered correct, in that case the weak attribute neither bears any semantics nor is rejected by the compiler.