1 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
2 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
3 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
4 // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
6 namespace dr727 { // dr727: partial
8 template<typename T> struct C; // expected-note 6{{here}}
9 template<typename T> void f(); // expected-note {{here}}
10 template<typename T> static int N; // expected-error 0-1{{C++14}} expected-note 6{{here}}
12 template<> struct C<int>;
13 template<> void f<int>();
14 template<> static int N<int>;
16 template<typename T> struct C<T*>;
17 template<typename T> static int N<T*>;
20 template<> struct C<float>; // expected-error {{not in class 'A' or an enclosing namespace}}
21 template<> void f<float>(); // expected-error {{no function template matches}}
22 template<> static int N<float>; // expected-error {{not in class 'A' or an enclosing namespace}}
24 template<typename T> struct C<T**>; // expected-error {{not in class 'A' or an enclosing namespace}}
25 template<typename T> static int N<T**>; // expected-error {{not in class 'A' or an enclosing namespace}}
27 template<> struct A::C<double>; // expected-error {{not in class 'A' or an enclosing namespace}}
28 template<> void A::f<double>(); // expected-error {{no function template matches}} expected-error {{cannot have a qualified name}}
29 template<> static int A::N<double>; // expected-error {{not in class 'A' or an enclosing namespace}} expected-error {{cannot have a qualified name}}
31 template<typename T> struct A::C<T***>; // expected-error {{not in class 'A' or an enclosing namespace}}
32 template<typename T> static int A::N<T***>; // expected-error {{not in class 'A' or an enclosing namespace}} expected-error {{cannot have a qualified name}}
36 template<> struct A::C<char>;
37 template<> void A::f<char>();
38 template<> int A::N<char>;
40 template<typename T> struct A::C<T****>;
41 template<typename T> int A::N<T****>;
44 template<> struct A::C<long>; // expected-error {{not in class 'A' or an enclosing namespace}}
45 template<> void A::f<long>(); // expected-error {{not in class 'A' or an enclosing namespace}}
46 template<> int A::N<long>; // expected-error {{not in class 'A' or an enclosing namespace}}
48 template<typename T> struct A::C<T*****>; // expected-error {{not in class 'A' or an enclosing namespace}}
49 template<typename T> int A::N<T*****>; // expected-error {{not in class 'A' or an enclosing namespace}}
54 template<typename T> struct C { typename T::error e; }; // expected-error {{no members}}
55 template<typename T> void f() { T::error; } // expected-error {{no members}}
56 template<typename T> static const int N = T::error; // expected-error 2{{no members}} expected-error 0-1{{C++14}}
58 template<> struct C<int> {};
59 template<> void f<int>() {}
60 template<> static const int N<int>;
62 template<typename T> struct C<T*> {};
63 template<typename T> static const int N<T*>;
69 int a = D<int>::N<int>; // FIXME: expected-note {{instantiation of}}
72 int b = D<int>::N<int*>;
74 D<int>::C<float>(); // expected-note {{instantiation of}}
75 di.f<float>(); // expected-note {{instantiation of}}
76 int c = D<int>::N<float>; // expected-note {{instantiation of}}
80 namespace dr777 { // dr777: 3.7
81 #if __cplusplus >= 201103L
82 template <typename... T>
83 void f(int i = 0, T ...args) {}
86 template <typename... T>
87 void g(int i = 0, T ...args, T ...args2) {}
89 template <typename... T>
90 void h(int i = 0, T ...args, int j = 1) {}