https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95686
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|11.0 |9.3.0 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Known to fail| |9.3.0 Last reconfirmed| |2020-06-16 Keywords| |accepts-invalid --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- clang complains t.C:9:16: error: non-type template argument refers to object 'i' that does not have linkage return S<&i>{}; ^ t.C:8:26: note: non-type template argument refers to object here static const int i = 0; ^ so this means your code is ill-formed. I can confirm your observation with GCC 9.3 but GCC 10.1 rejects the code as well: t.C: In function ?auto foo()?: t.C:9:17: error: ?& i? is not a valid template argument of type ?const int*? because ?i? has no linkage 9 | return S<&i>{}; | ^