1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -std=c++1y -verify %s -DCXX1Y
6 template<typename T
, typename U
, U
> using alias_ref
= T
;
7 template<typename T
, typename U
, U
> void func_ref() {}
8 template<typename T
, typename U
, U
> struct class_ref
{};
15 template<int N
> struct S
; // expected-note 6{{here}}
18 int U
<N
>::a
= S
<N
>::kError
; // expected-error 6{{undefined}}
22 (void)alias_ref
<int, int&, U
<0>::a
>(); // expected-note {{here}}
23 (void)func_ref
<int, int&, U
<1>::a
>(); // expected-note {{here}}
24 (void)class_ref
<int, int&, U
<2>::a
>(); // expected-note {{here}}
28 void not_instantiated() {
29 // These cases (arguably) do not require instantiation of U<i>::a.
30 (void)alias_ref
<int, int&, U
<3>::a
>();
31 (void)func_ref
<int, int&, U
<4>::a
>();
32 (void)class_ref
<int, int&, U
<5>::a
>();
37 (void)alias_ref
<int, int&, U
<N
>::a
>(); // expected-note {{here}}
38 (void)func_ref
<int, int&, U
<N
+1>::a
>(); // expected-note {{here}}
39 (void)class_ref
<int, int&, U
<N
+2>::a
>(); // expected-note {{here}}
43 f
<int>(); // expected-note 3{{here}}
44 fi
<10>(); // expected-note 3{{here}}
48 template<typename T
> struct S
{ static int n
; };
49 template<typename T
> int S
<T
>::n
= 5;
51 template<typename T
> int f() {
61 namespace { template<typename
> extern int n
; }
62 template<typename T
> int g() { return n
<int>; }
63 namespace { extern template int n
<int>; } // expected-error {{explicit instantiation declaration of 'n<int>' with internal linkage}}