1 // RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
2 
3 template <typename... Args> requires ((sizeof(Args) == 1), ...)
4 // expected-note@-1 {{because '(sizeof(int) == 1) , (sizeof(char) == 1) , (sizeof(int) == 1)' evaluated to false}}
f1(Args &&...args)5 void f1(Args&&... args) { }
6 // expected-note@-1 {{candidate template ignored: constraints not satisfied [with Args = <int, char, int>]}}
7 
8 using f11 = decltype(f1('a'));
9 using f12 = decltype(f1(1, 'b'));
10 using f13 = decltype(f1(1, 'b', 2));
11 // expected-error@-1 {{no matching function for call to 'f1'}}
12 
13 template <typename... Args>
f2(Args &&...args)14 void f2(Args&&... args) requires ((sizeof(args) == 1), ...) { }
15 // expected-note@-1 {{candidate template ignored: constraints not satisfied [with Args = <int, char, int>]}}
16 // expected-note@-2 {{because '(sizeof (args) == 1) , (sizeof (args) == 1) , (sizeof (args) == 1)' evaluated to false}}
17 
18 using f21 = decltype(f2('a'));
19 using f22 = decltype(f2(1, 'b'));
20 using f23 = decltype(f2(1, 'b', 2));
21 // expected-error@-1 {{no matching function for call to 'f2'}}
22 
23 template <typename... Args> requires ((sizeof(Args) == 1), ...)
24 // expected-note@-1 {{because '(sizeof(int) == 1) , (sizeof(char) == 1) , (sizeof(int) == 1)' evaluated to false}}
f3(Args &&...args)25 void f3(Args&&... args) requires ((sizeof(args) == 1), ...) { }
26 // expected-note@-1 {{candidate template ignored: constraints not satisfied [with Args = <int, char, int>]}}
27 
28 using f31 = decltype(f3('a'));
29 using f32 = decltype(f3(1, 'b'));
30 using f33 = decltype(f3(1, 'b', 2));
31 // expected-error@-1 {{no matching function for call to 'f3'}}
32 
33 template<typename T>
34 struct S {
35 	template<typename U>
fS36 	static constexpr auto f(U const index) requires(index, true) {
37 		return true;
38 	}
39 };
40 
41 static_assert(S<void>::f(1));
42 
43 constexpr auto value = 0;
44 
45 template<typename T>
46 struct S2 {
47   template<typename = void> requires(value, true)
fS248   static constexpr auto f() requires(value, true) {
49   }
50 };
51 
52 static_assert((S2<int>::f(), true));
53 
54 template<typename T>
55 struct S3 {
56 	template<typename... Args> requires true
fS357 	static constexpr void f(Args...) { }
58 };
59 
60 static_assert((S3<int>::f(), true));
61 
62 template<typename T>
63 struct S4 {
64     template<typename>
fooS465     constexpr void foo() requires (*this, true) { }
gooS466     constexpr void goo() requires (*this, true) { }
67 };
68 
69 static_assert((S4<int>{}.foo<int>(), S4<int>{}.goo(), true));
70