blob: c977eaa8fcda93ae0881ce6754750528f75391e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// PR c++/67159
// { dg-options "-std=c++17 -fconcepts" }
template <class T, class U>
concept bool SameAs = __is_same_as(T, U);
template <class T>
concept bool R1 = requires (T& t) {
{ t.begin() } -> T
{ t.end() } -> SameAs<T*>;
};
template <class T>
concept bool R2 = requires (T& t) {
{ t.end() } -> SameAs<T*>;
};
struct foo {
int* begin();
int* end();
};
R1{T}
constexpr bool f() { return true; }
R2{T}
constexpr bool g() { return true; }
static_assert(f<foo>()); // { dg-error "" }
static_assert(g<foo>()); // { dg-error "" }
|