summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/arm12.C
blob: c0332d3673336957023429efc1f4440ee86b04ee (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
49
// { dg-do assemble  }
// GROUPS passed ARM-compliance
// arm file
// From: belley@cae.ca (Benoit Belley 3218)
// Subject: Bad access control with private constructor and derivation
// Date: Fri, 28 May 1993 12:39:57 -0400 (EDT)

#include <iostream>

class X
{
public:
  void f();

private:
  X();
};

class Y : public X
{
public:
  Y();
};

X::X() // { dg-error "is private" }
{
  std::cout << "X::X()" << std::endl;
}

void X::f()
{
  std::cout << "X::f()" << std::endl;
}

Y::Y() // { dg-error "within this context" }
{
  std::cout << "Y::Y()" << std::endl;
}


int main()
{
  Y y;
  y.f();
}