https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105438
--- Comment #2 from Bernie Innocenti <bernie at codewiz dot org> --- GCC 12.0.1 20220413 (Red Hat 12.0.1-0) gives a more helpful diagnostic with inlining backtrace: In function ‘void configure(const int (&)[N], int) [with int N = 7]’, inlined from ‘void configure(const int (&)[N], int) [with int N = 2]’ at testcase.cc:8:6, inlined from ‘int main()’ at gcc-array-bounds-bug-testcase.cc:22:12: testcase.cc:14:24: warning: array subscript ‘const int [7][0]’ is partly outside array bounds of ‘int [2]’ [-Warray-bounds] 14 | out[i] = in[i]; | ~~^ Note how configure<N=7>() was inlined into configure<N=7>().