aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/explicit-obj-diagnostics11.C
blob: cc2571f62a2d75468ec98771dde2db27f42bffcb (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// PR c++/115783
// { dg-do compile { target c++23 } }

struct A {
  int f(this auto);

  static void s() {
    f(); // { dg-error "without object" }
  }
};

int n = A::f(); // { dg-error "without object" }

struct B {
  void ns() {
    A::f(); // { dg-error "without object" }
  }

  static void s() {
    A::f(); // { dg-error "without object" }
  }
};

template<class T>
struct C {
  void ns() {
    A::f(); // { dg-error "without object" }
    T::f(); // { dg-error "without object" }
  }

  static void s() {
    A::f(); // { dg-error "without object" }
    T::f(); // { dg-error "without object" }
  };
};

template struct C<A>;

template<class T>
struct D : T {
  void ns() {
    A::f(); // { dg-error "without object" }
    T::f(); // { dg-error "not a member of 'B'" }
  }
};

template struct D<B>; // { dg-message "required from here" }
template struct D<A>; // { dg-bogus "required from here" }