https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110128
--- Comment #1 from jwjagersma at gmail dot com --- Additionally, the following example does not produce any -Wattributes warnings at all, but the attributes are still not copied: template<int> struct check_num { static void check(); }; template<> struct check_num<13> { [[gnu::warning("unlucky number")]] static void check(); }; template<> struct check_num<666> { [[gnu::error("evil number")]] static void check(); }; template<int I> [[gnu::copy(check_num<I>::check)]] int num() { return I; } int main() { return num<42>() + num<13>() + num<666>(); }