https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108234
Bug ID: 108234 Summary: GCC accepts invalid program involving nontype template parameter of auto with non constexpr variable Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlame646 at gmail dot com Target Milestone: --- GCC trunk accepts the following invalid program: https://godbolt.org/z/h5q7589Tr ``` template <int&> struct X{}; template <auto V> int func(X<V>) { return 1; } int i; int main() { return func(X<i>{}); } ``` Clang rejects the above program while gcc and msvc accepts it.