Changeset View
Changeset View
Standalone View
Standalone View
clang/test/SemaTemplate/instantiate-requires-clause.cpp
Show All 34 Lines | struct S { | ||||
template<typename U> | template<typename U> | ||||
static constexpr auto f(U const index) requires(index, true) { | static constexpr auto f(U const index) requires(index, true) { | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
static_assert(S<void>::f(1)); | static_assert(S<void>::f(1)); | ||||
// Similar to the 'S' test, but tries to use 'U' in the requires clause. | |||||
template<typename T2> | |||||
struct S1 { | |||||
// expected-note@+3 {{candidate template ignored: constraints not satisfied [with U = int]}} | |||||
// expected-note@+2 {{because substituted constraint expression is ill-formed: type 'int' cannot be used prior to '::' because it has no members}} | |||||
template <typename U> | |||||
static constexpr auto f(U const index) requires(U::foo) { return true; } | |||||
}; | |||||
// expected-error@+1 {{no matching function for call to 'f'}} | |||||
static_assert(S1<void>::f(1)); | |||||
constexpr auto value = 0; | constexpr auto value = 0; | ||||
template<typename T> | template<typename T> | ||||
struct S2 { | struct S2 { | ||||
template<typename = void> requires(value, true) | template<typename = void> requires(value, true) | ||||
static constexpr auto f() requires(value, true) { | static constexpr auto f() requires(value, true) { | ||||
} | } | ||||
}; | }; | ||||
Show All 19 Lines |