brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 499e6ab Raw
61 lines · cpp
1// RUN: %clang_cc1 -std=c++2a -x c++ -verify %s2 3namespace nodiag {4 5template <typename T> requires (bool(T()))6int A();7template <typename U> requires (bool(U()))8int A();9 10} // end namespace nodiag11 12namespace diag {13 14namespace orig {15  template <typename T> requires true16  int A();17  template <typename T>18  int B();19  template <typename T> requires true20  int C();21}22 23template <typename T>24int orig::A();25// expected-error@-1{{out-of-line declaration of 'A' does not match any declaration in namespace 'diag::orig'}}26template <typename T> requires true27int orig::B();28// expected-error@-1{{out-of-line declaration of 'B' does not match any declaration in namespace 'diag::orig'}}29template <typename T> requires (!0)30int 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 diag34 35namespace nodiag {36 37struct AA {38  template <typename T> requires (someFunc(T()))39  int A();40};41 42template <typename T> requires (someFunc(T()))43int AA::A() { return sizeof(T); }44 45} // end namespace nodiag46 47namespace diag {48 49template <unsigned N>50struct TA { // #defined-here51  template <template <unsigned> class TT> requires TT<N>::happy52  int A();53};54 55template <unsigned N>56template <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 'diag::TA<N>'}}58// expected-note@#defined-here{{defined here}}59 60} // end namespace diag61