blob: aa0ad94bef72101237bac5b44069b7b031b0ed3b [file] [log] [blame]
Saar Raz67c608a2020-01-24 00:43:22 +02001// RUN: %clang_cc1 -std=c++2a -verify %s
2// RUN: %clang_cc1 -std=c++2a -verify %s -fno-concept-satisfaction-caching -DNO_CACHE
Saar Razb933d372020-01-22 02:50:12 +02003// expected-no-diagnostics
4
5template<typename T>
6concept C = (f(T()), true);
7
8template<typename T>
9constexpr bool foo() { return false; }
10
11template<typename T>
12 requires (f(T()), true)
13constexpr bool foo() requires (f(T()), true) { return true; }
14
15namespace a {
16 struct A {};
17 void f(A a);
18}
19
20static_assert(C<a::A>);
21static_assert(foo<a::A>());
22
23namespace a {
24 // This makes calls to f ambiguous, but the second check will still succeed
25 // because the constraint satisfaction results are cached.
26 void f(A a, int = 2);
27}
28#ifdef NO_CACHE
29static_assert(!C<a::A>);
30static_assert(!foo<a::A>());
31#else
32static_assert(C<a::A>);
33static_assert(foo<a::A>());
34#endif