Given: void consoom(void(*)()); template<int *, unsigned> void withN() {} template<int *, int *> void withP() {} static int scalar; static int array[1]; int main() { consoom(withN<&scalar, 1>); consoom(withN<array, 1>); consoom(withP<&scalar, &scalar + 1>); consoom(withP<array, array + 1>); } clang trunk and gcc trunk -std=c++{11,14,17} agree that <source>: In function 'int main()': <source>:17:12: error: no matches converting function 'withP' to type 'void (*)()' 17 | consoom(withP<&scalar, &scalar + 1>); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:7:6: note: candidate is: 'template<int* <anonymous>, int* <anonymous> > void withP()' 7 | void withP() {} | ^~~~~ <source>:18:12: error: no matches converting function 'withP' to type 'void (*)()' 18 | consoom(withP<array, array + 1>); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:7:6: note: candidate is: 'template<int* <anonymous>, int* <anonymous> > void withP()' 7 | void withP() {} | ^~~~~ Compiler returned: 1 or <source>:17:5: error: no matching function for call to 'consoom' 17 | consoom(withP<&scalar, &scalar + 1>); | ^~~~~~~ <source>:1:6: note: candidate function not viable: no overload of 'withP' matching 'void (*)()' for 1st argument 1 | void consoom(void(*)()); | ^ ~~~~~~~~~ <source>:18:5: error: no matching function for call to 'consoom' 18 | consoom(withP<array, array + 1>); | ^~~~~~~ <source>:1:6: note: candidate function not viable: no overload of 'withP' matching 'void (*)()' for 1st argument 1 | void consoom(void(*)()); | ^ ~~~~~~~~~ 2 errors generated. Compiler returned: 1 clang trunk -std=c++20 accepts the code. GCC trunk -std=c++20 rejects the code with the same error. https://godbolt.org/z/63xzf1MT6 Per my reading of [temp.arg.nontype].6, this is allowed in C++20 because it's not rejected by [temp.arg.nontype].6.{1,2,3,4,5}.
<source>:17:32: error: '((& scalar) + 4)' is not a valid template argument for 'int*' because it is not the address of a variable
Reduced testcase: ``` template<int *, int *> void withP() {} int array[2]; int main() { withP<array, array+1>(); withP<array, &array[1]>(); } ``` GCC and MSVC both reject `array+1` . All three accept `&array[1]` though in C++20+.