• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN:  %clang_cc1 -std=c++2a -verify %s
2 
3 auto l1 = [] (auto x) requires (sizeof(decltype(x)) == 1) { return x; };
4 // expected-note@-1{{candidate template ignored: constraints not satisfied [with x:auto = int]}}
5 // expected-note@-2{{because 'sizeof(decltype(x)) == 1' (4 == 1) evaluated to false}}
6 
7 auto l1t1 = l1('a');
8 auto l1t2 = l1(1);
9 // expected-error@-1{{no matching function for call to object of type '(lambda at}}
10 
11 auto l2 = [] (auto... x) requires ((sizeof(decltype(x)) >= 2) && ...) { return (x + ...); };
12 // expected-note@-1{{candidate template ignored: constraints not satisfied [with x:auto = <char>]}}
13 // expected-note@-2{{candidate template ignored: constraints not satisfied [with x:auto = <int, char>]}}
14 // expected-note@-3 2{{because 'sizeof(decltype(x)) >= 2' (1 >= 2) evaluated to false}}
15 
16 auto l2t1 = l2('a');
17 // expected-error@-1{{no matching function for call to object of type '(lambda at}}
18 auto l2t2 = l2(1, 'a');
19 // expected-error@-1{{no matching function for call to object of type '(lambda at}}
20 auto l2t3 = l2((short)1, (short)1);