summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/parse/crash40.C
blob: 410c2111eaaf2033015e581f29dd55b0e6c6cf29 (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-error "is private" } */
};
struct BB : AA {};

class AAA {
  int get() const {}
};
struct BBB {
  static BBB *foo();
private:
  int get() const {} /* { dg-error "is 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());
};

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; /* { dg-error "default argument" } */
  SS<false> ss; /* { dg-error "within this context" } */
}