https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83936
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2018-01-26 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed based on comment #4. As a side note, the limitation isn't specific to back-ends. The C++ front-end itself doesn't accept a constexpr string as an argument to an attribute that expects a string. (For the one attribute the C++ standard specifies that takes a string argument it requires it to be a string literal. But G++ could accept constexpr strings in other attributes, target-specific or otherwise, and even in the standard [[deprecated(msg)]] attribute G++ could accept it as an extension.) $ cat t.C && gcc -S -Wall -Wextra -Wpedantic -Wswitch-enum t.C struct A { static constexpr const char msg[] = "string doesn't work"; static constexpr unsigned align = 4; }; template <class T> struct B { static void foo [[gnu::deprecated (T::msg)]] () { } typedef int I4 [[gnu::aligned (T::align)]]; }; static_assert (alignof (B<A>::I4) == A::align, "number works"); void h() { B<A>::foo (); } t.C: In instantiation of ‘struct B<A>’: t.C:14:29: required from here t.C:10:15: error: deprecated message is not a string static void foo [[gnu::deprecated (T::msg)]] () { } ^~~ t.C: In function ‘void h()’: t.C:18:9: warning: ‘static void B<T>::foo() [with T = A]’ is deprecated [-Wdeprecated-declarations] B<A>::foo (); ^~~ t.C:10:15: note: declared here static void foo [[gnu::deprecated (T::msg)]] () { } ^~~ t.C:18:14: warning: ‘static void B<T>::foo() [with T = A]’ is deprecated [-Wdeprecated-declarations] B<A>::foo (); ^ t.C:10:15: note: declared here static void foo [[gnu::deprecated (T::msg)]] () { } ^~~