https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85589
Bug ID: 85589 Summary: Non type template parameter should allow object with no linkage Product: gcc Version: 7.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gufideg at gmail dot com Target Milestone: --- Even though n4268 is marked as supported fully here: https://gcc.gnu.org/projects/cxx-status.html, GCC does not yet support passing the address or reference to an object with no linkage. Such code should compile under C++17: template<auto& v> struct foo {}; int main() { static auto v = "str"; (void) foo<v> {}; } But fail with: error: 'v' is not a valid template argument for type 'const char*&' because object 'v' does not have linkage (void) foo<v> {}; ^ Such code compiles under clang 6.0.0. Live example: https://godbolt.org/g/aXjDBg