aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-complete3.C
blob: 5b07371a6be4fb76136834436790d0e73b255e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Verify we diagnose an unstable satisfaction result that depends on
// return type deduction of the member function A::foo() below.
//
// { dg-do compile { target c++20 } }

template <class T> concept fooable = requires (T t) { t.foo(); };
// { dg-error "'false' to 'true'" "" { target *-*-* } .-1 }

template <fooable T> int f () { return 0; }
template <class T> char f() { return 0; }

struct A { auto foo(); };
static_assert (sizeof (f<A>()) == 1); // { dg-message "first evaluated to 'false' from here" }
auto A::foo() { }
static_assert (sizeof (f<A>()) > 1); // { dg-error "assert" }
static_assert (sizeof (f<A>()) > 1);