2 // RUN: %clang_cc1 -x c++ -I %S/Inputs/redecl-templates %s -verify -std=c++14
3 // RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/redecl-templates %s -verify -std=c++14
5 template<int N
> struct A
{};
6 template<int N
> using X
= A
<N
>;
8 template<int N
> constexpr void f() {}
9 template<int N
> constexpr void g() { f
<N
>(); }
11 template<int N
> extern int v
;
12 template<int N
> int &w
= v
<N
>;
16 // Be careful not to mention A here, that'll import the decls from "a.h".
20 // This will implicitly instantiate A<1> if we haven't imported the explicit
21 // specialization declaration from "a.h".
23 // Likewise for f and v.
27 // This is OK: we declared the explicit specialization before we triggered
28 // instantiation of this specialization.
29 template<> struct A
<1> {};
30 template<> constexpr void f
<1>() {}
31 // Variable template explicit specializations are always definitions unless they
32 // are static data members declared without an initializer.
33 template<> int v
<1>; // expected-error {{redefinition of 'v<1>'}}
34 // expected-note@Inputs/redecl-templates/a.h:8 {{previous definition is here}}