Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/concepts-complete1.C

raw
1 // Verify we diagnose an unstable satisfaction result that depends on
2 // completeness of the type A below.
3 //
4 // { dg-do compile { target c++20 } }
5
6 template <class T> concept has_mem_type = requires { typename T::type; };
7 // { dg-message "satisfaction of 'has_mem_type<T>' .with T = A." "" { target *-*-* } .-1 }
8 // { dg-error "satisfaction value of atomic constraint 'requires.typename T::type;. .with T = A.' changed from 'false' to 'true'" "" { target *-*-* } .-2 }
9
10 template <has_mem_type T> int f () { return 0; }
11 template <class T> char f() { return 0; }
12
13 struct A;
14 static_assert (sizeof (f<A>()) == 1); // { dg-message "first evaluated to 'false' from here" }
15 struct A { typedef int type; };
16 static_assert (sizeof (f<A>()) > 1); // { dg-error "assert" }
17 // { dg-message "required from here" "" { target *-*-* } .-1 }
18 static_assert (sizeof (f<A>()) > 1);