xref: /llvm-project/clang/test/CXX/expr/expr.prim/expr.prim.lambda/expr.prim.lambda.closure/p3.cpp (revision 67c608a9695496cfc9d3fdf9d0b12b554ac6b4df)
1*67c608a9SSaar Raz // RUN:  %clang_cc1 -std=c++2a -verify %s
2b65b1f32SSaar Raz 
3b65b1f32SSaar Raz auto l1 = [] (auto x) requires (sizeof(decltype(x)) == 1) { return x; };
4b481f028SSaar Raz // expected-note@-1{{candidate template ignored: constraints not satisfied [with x:auto = int]}}
5b65b1f32SSaar Raz // expected-note@-2{{because 'sizeof(decltype(x)) == 1' (4 == 1) evaluated to false}}
6b65b1f32SSaar Raz 
7b65b1f32SSaar Raz auto l1t1 = l1('a');
8b65b1f32SSaar Raz auto l1t2 = l1(1);
9b65b1f32SSaar Raz // expected-error@-1{{no matching function for call to object of type '(lambda at}}
10b65b1f32SSaar Raz 
11b65b1f32SSaar Raz auto l2 = [] (auto... x) requires ((sizeof(decltype(x)) >= 2) && ...) { return (x + ...); };
12b481f028SSaar Raz // expected-note@-1{{candidate template ignored: constraints not satisfied [with x:auto = <char>]}}
13b481f028SSaar Raz // expected-note@-2{{candidate template ignored: constraints not satisfied [with x:auto = <int, char>]}}
14b65b1f32SSaar Raz // expected-note@-3 2{{because 'sizeof(decltype(x)) >= 2' (1 >= 2) evaluated to false}}
15b65b1f32SSaar Raz 
16b65b1f32SSaar Raz auto l2t1 = l2('a');
17b65b1f32SSaar Raz // expected-error@-1{{no matching function for call to object of type '(lambda at}}
18b65b1f32SSaar Raz auto l2t2 = l2(1, 'a');
19b65b1f32SSaar Raz // expected-error@-1{{no matching function for call to object of type '(lambda at}}
20b65b1f32SSaar Raz auto l2t3 = l2((short)1, (short)1);