| 1 |
// PR c++/115783 |
| 2 |
// { dg-do compile { target c++23 } } |
| 3 |
|
| 4 |
struct A { |
| 5 |
int f(this auto); |
| 6 |
|
| 7 |
static void s() { |
| 8 |
f(); // { dg-error "without object" } |
| 9 |
} |
| 10 |
}; |
| 11 |
|
| 12 |
int n = A::f(); // { dg-error "without object" } |
| 13 |
|
| 14 |
struct B { |
| 15 |
void ns() { |
| 16 |
A::f(); // { dg-error "without object" } |
| 17 |
} |
| 18 |
|
| 19 |
static void s() { |
| 20 |
A::f(); // { dg-error "without object" } |
| 21 |
} |
| 22 |
}; |
| 23 |
|
| 24 |
template<class T> |
| 25 |
struct C { |
| 26 |
void ns() { |
| 27 |
A::f(); // { dg-error "without object" } |
| 28 |
T::f(); // { dg-error "without object" } |
| 29 |
} |
| 30 |
|
| 31 |
static void s() { |
| 32 |
A::f(); // { dg-error "without object" } |
| 33 |
T::f(); // { dg-error "without object" } |
| 34 |
}; |
| 35 |
}; |
| 36 |
|
| 37 |
template struct C<A>; |
| 38 |
|
| 39 |
template<class T> |
| 40 |
struct D : T { |
| 41 |
void ns() { |
| 42 |
A::f(); // { dg-error "without object" } |
| 43 |
T::f(); // { dg-error "not a member of 'B'" } |
| 44 |
} |
| 45 |
}; |
| 46 |
|
| 47 |
template struct D<B>; // { dg-message "required from here" } |
| 48 |
template struct D<A>; // { dg-bogus "required from here" } |