1 // RUN: %clang_cc1 -std=c++2a -x c++ -verify %s 2 3 namespace nodiag { 4 5 template <typename T> requires (bool(T())) 6 int A(); 7 template <typename U> requires (bool(U())) 8 int A(); 9 10 } // end namespace nodiag 11 12 namespace diag { 13 14 namespace orig { 15 template <typename T> requires true 16 int A(); 17 template <typename T> 18 int B(); 19 template <typename T> requires true 20 int C(); 21 } 22 23 template <typename T> 24 int orig::A(); 25 // expected-error@-1{{out-of-line declaration of 'A' does not match any declaration in namespace 'diag::orig'}} 26 template <typename T> requires true 27 int orig::B(); 28 // expected-error@-1{{out-of-line declaration of 'B' does not match any declaration in namespace 'diag::orig'}} 29 template <typename T> requires (!0) 30 int orig::C(); 31 // expected-error@-1{{out-of-line declaration of 'C' does not match any declaration in namespace 'diag::orig'}} 32 33 } // end namespace diag 34 35 namespace nodiag { 36 37 struct AA { 38 template <typename T> requires (someFunc(T())) 39 int A(); 40 }; 41 42 template <typename T> requires (someFunc(T())) 43 int AA::A() { return sizeof(T); } 44 45 } // end namespace nodiag 46 47 namespace diag { 48 49 template <unsigned N> 50 struct TA { // #defined-here 51 template <template <unsigned> class TT> requires TT<N>::happy 52 int A(); 53 }; 54 55 template <unsigned N> 56 template <template <unsigned> class TT> int TA<N>::A() { return sizeof(TT<N>); } 57 // expected-error@-1{{out-of-line definition of 'A' does not match any declaration in 'TA<N>'}} 58 // expected-note@#defined-here{{defined here}} 59 60 } // end namespace diag 61