1 // RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ %s -verify 2 // expected-no-diagnostics 3 4 // Test parsing of the optional requires-clause in a template-declaration. 5 6 template <typename T> requires true 7 void foo() { } 8 9 10 template <typename T> requires !0 11 struct A { 12 void foo(); 13 struct AA; 14 enum E : int; 15 static int x; 16 17 template <typename> requires true 18 void Mfoo(); 19 20 template <typename> requires true 21 struct M; 22 23 template <typename> requires true 24 static int Mx; 25 26 template <typename TT> requires true 27 using MQ = M<TT>; 28 }; 29 30 template <typename T> requires !0 31 void A<T>::foo() { } 32 33 template <typename T> requires !0 34 struct A<T>::AA { }; 35 36 template <typename T> requires !0 37 enum A<T>::E : int { E0 }; 38 39 template <typename T> requires !0 40 int A<T>::x = 0; 41 42 template <typename T> requires !0 43 template <typename> requires true 44 void A<T>::Mfoo() { } 45 46 template <typename T> requires !0 47 template <typename> requires true 48 struct A<T>::M { }; 49 50 template <typename T> requires !0 51 template <typename> requires true 52 int A<T>::Mx = 0; 53 54 55 template <typename T> requires true 56 int x = 0; 57 58 template <typename T> requires true 59 using Q = A<T>; 60 61 struct C { 62 template <typename> requires true 63 void Mfoo(); 64 65 template <typename> requires true 66 struct M; 67 68 template <typename> requires true 69 static int Mx; 70 71 template <typename T> requires true 72 using MQ = M<T>; 73 }; 74 75 template <typename> requires true 76 void C::Mfoo() { } 77 78 template <typename> requires true 79 struct C::M { }; 80 81 template <typename> requires true 82 int C::Mx = 0; 83