https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96516
--- Comment #4 from sagebar at web dot de --- (In reply to sagebar from comment #3) > ..., _any_ attribute that > can be inherited via copy() can be made template-conditional in c++: Also note that I've tested if gcc (`-x c') allows multiple copy attributes on the same declaration, and it appears to do allow this, meaning that deferring attribute copy until template instantiation should be made functional for 0-N copy attributes, rather than 0-1: gcc currently allows multiple __attribute__((copy)) within the same declaration: ``` __attribute__((returns_nonnull)) void *func_with_returns_nonnull(); __attribute__((malloc)) void *func_with_malloc(); __attribute__(( copy(func_with_returns_nonnull), copy(func_with_malloc))) void *func_with_both(); #define SASS(x) static_assert(x, #x) SASS(__builtin_has_attribute(func_with_returns_nonnull, returns_nonnull)); SASS(!__builtin_has_attribute(func_with_returns_nonnull, malloc)); SASS(!__builtin_has_attribute(func_with_malloc, returns_nonnull)); SASS(__builtin_has_attribute(func_with_malloc, malloc)); SASS(__builtin_has_attribute(func_with_both, returns_nonnull)); SASS(__builtin_has_attribute(func_with_both, malloc)); ```