| 1 |
// PR c++/96410 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
struct S { using blah = void; }; |
| 5 |
|
| 6 |
template <typename T> constexpr bool trait = !__is_same(T, S); |
| 7 |
template <typename T> concept C = trait<T>; |
| 8 |
|
| 9 |
template<typename T> |
| 10 |
void foo() noexcept(!__is_same(T, void)) { } |
| 11 |
|
| 12 |
template<typename U> |
| 13 |
auto f() { |
| 14 |
return []<typename T>(T, bool a = requires { C<T>; }){ // { dg-warning Wmissing-requires } |
| 15 |
static_assert(requires { requires C<U> && (C<T> || C<T>); }); // { dg-error "assert" } |
| 16 |
static_assert(requires { C<T>; }); // { dg-warning Wmissing-requires } |
| 17 |
static_assert(requires { { foo<T>() } noexcept -> C; }); |
| 18 |
static_assert(!requires { typename T::blah; }); // { dg-error "assert" } |
| 19 |
return 0; |
| 20 |
}; |
| 21 |
} |
| 22 |
|
| 23 |
auto g = f<int>(); // { dg-bogus "" } |
| 24 |
int n = g(0); // { dg-bogus "" } |
| 25 |
int m = g(S{}); // { dg-message "required from here" } |