summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/parse/crash40.C
blob: 537cdb78ef1965eca0bfef0fe9a5023aab4b7f34 (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
/* PR c++/34059 */
/* { dg-do compile } */

struct A
{
  template<int> void foo();
};
struct B : A {};
struct C : A {};

class AA
{
  template<int> void foo(); /* { dg-message "private" } */
};
struct BB : AA {};

class AAA {
  int get() const {}
};
struct BBB {
  static BBB *foo();
private:
  int get() const {} /* { dg-message "private" } */
};
template<bool> struct S {
  S(unsigned int = BBB::foo()->AAA::get()); /* { dg-error "is not a base of" } */
};
template<bool> struct SS {
  SS(unsigned int = BBB::foo()->get()); /* { dg-error "within this context" } */
};

void bar()
{
  B().C::foo<0>(); /* { dg-error "is not a member of" } */
  BB().AA::foo<0>(); /* { dg-error "within this context" } */

  int i;
  i.C::foo<0>(); /* { dg-error "which is of non-class type" } */

  S<false> s;
  SS<false> ss;
}