[Bug c++/114165] &scalar+1 and array+1 rejected as template parameters

2024-03-01 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114165 --- Comment #2 from Andrew Pinski --- Reduced testcase: ``` template void withP() {} int array[2]; int main() { withP(); withP(); } ``` GCC and MSVC both reject `array+1` . All three accept `&array[1]` though in C++20+.

[Bug c++/114165] &scalar+1 and array+1 rejected as template parameters

2024-03-01 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114165 --- Comment #1 from Andrew Pinski --- :17:32: error: '((& scalar) + 4)' is not a valid template argument for 'int*' because it is not the address of a variable