https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83936
--- Comment #2 from Roland Schulz <roland at rschulz dot eu> --- Do you mean for the target attribute or for all attributes in general? The following example suggests that for the alloc_align attribute it works to have the argument depend on a template argument. template<int xx> [[gnu::alloc_align(xx)]] void *a(int align); void test(int align) { a<1>(align); a<2>(align); } $ g++ test_attr.cc -Wall -Wextra -c test_attr.cc: In substitution of 'template<int xx> void* a(int) [with int xx = 2]': test_attr.cc:8:15: required from here test_attr.cc:3:7: warning: alloc_align parameter outside range [-Wattributes] void *a(int align);