| 1 |
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify=expected,cxx11 %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -verify=expected,since-cxx14 %s |
| 3 |
|
| 4 |
struct A { |
| 5 |
template<typename T> |
| 6 |
void f0(); |
| 7 |
|
| 8 |
template<> |
| 9 |
constexpr void f0<short>(); // cxx11-error {{conflicting types for 'f0'}} |
| 10 |
// cxx11-note@-1 {{previous declaration is here}} |
| 11 |
// cxx11-warning@-2 {{'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const'}} |
| 12 |
|
| 13 |
template<typename T> |
| 14 |
void f1() const; // since-cxx14-note 2{{candidate template ignored: could not match 'void () const' against 'void ()'}} |
| 15 |
|
| 16 |
template<> |
| 17 |
constexpr void f1<short>(); // since-cxx14-error {{no function template matches function template specialization 'f1'}} |
| 18 |
// cxx11-warning@-1 {{'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const'}} |
| 19 |
}; |
| 20 |
|
| 21 |
template<> |
| 22 |
constexpr void A::f0<long>(); // cxx11-error {{conflicting types for 'f0'}} |
| 23 |
// cxx11-note@-1 {{previous declaration is here}} |
| 24 |
// cxx11-warning@-2 {{'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const'}} |
| 25 |
|
| 26 |
template<> |
| 27 |
constexpr void A::f1<long>(); // since-cxx14-error {{no function template matches function template specialization 'f1'}} |
| 28 |
// cxx11-warning@-1 {{'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const'}} |
| 29 |
|
| 30 |
// FIXME: It's unclear whether [temp.expl.spec]p12 is intended to apply to |
| 31 |
// members of a class template explicitly specialized for an implicitly |
| 32 |
// instantiated specialization of that template. |
| 33 |
template<typename T> |
| 34 |
struct B { // #defined-here |
| 35 |
void g0(); // since-cxx14-note {{previous declaration is here}} |
| 36 |
// cxx11-note@-1 {{member declaration does not match because it is not const qualified}} |
| 37 |
|
| 38 |
void g1() const; // since-cxx14-note {{member declaration does not match because it is const qualified}} |
| 39 |
// cxx11-note@-1 {{previous declaration is here}} |
| 40 |
|
| 41 |
template<typename U> |
| 42 |
void h0(); // since-cxx14-note {{previous declaration is here}} |
| 43 |
|
| 44 |
template<typename U> |
| 45 |
void h1() const; // cxx11-note {{previous declaration is here}} |
| 46 |
}; |
| 47 |
|
| 48 |
template<> |
| 49 |
constexpr void B<short>::g0(); // since-cxx14-error {{constexpr declaration of 'g0' follows non-constexpr declaration}} |
| 50 |
// cxx11-error@-1 {{out-of-line declaration of 'g0' does not match any declaration in 'B<short>'}} |
| 51 |
// cxx11-warning@-2 {{'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const'}} |
| 52 |
// expected-note@#defined-here {{defined here}} |
| 53 |
|
| 54 |
template<> |
| 55 |
constexpr void B<short>::g1(); // since-cxx14-error {{out-of-line declaration of 'g1' does not match any declaration in 'B<short>'}} |
| 56 |
// cxx11-error@-1 {{constexpr declaration of 'g1' follows non-constexpr declaration}} |
| 57 |
// cxx11-warning@-2 {{'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const'}} |
| 58 |
// expected-note@#defined-here {{defined here}} |
| 59 |
|
| 60 |
template<> |
| 61 |
template<typename U> |
| 62 |
constexpr void B<long>::h0(); // since-cxx14-error {{constexpr declaration of 'h0' follows non-constexpr declaration}} |
| 63 |
// cxx11-error@-1 {{out-of-line declaration of 'h0' does not match any declaration in 'B<long>'}} |
| 64 |
// cxx11-warning@-2 {{'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const'}} |
| 65 |
|
| 66 |
template<> |
| 67 |
template<typename U> |
| 68 |
constexpr void B<long>::h1(); // since-cxx14-error {{out-of-line declaration of 'h1' does not match any declaration in 'B<long>'}} |
| 69 |
// cxx11-error@-1 {{constexpr declaration of 'h1' follows non-constexpr declaration}} |
| 70 |
// cxx11-warning@-2 {{'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const'}} |