summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/pr5645.C
blob: 5ca61bdba4560a82fda24dd82a767cf9c20e4a5c (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
// PR5645: gcc warns that pure virtual class not explicitly initialized.  
// { dg-do compile }
// { dg-options "-Wall -Wextra" }

class a {
public:
  virtual int f() = 0;
  virtual int g() = 0;
};

class b : public a {
public:
  b();
  b(const b& c);

protected:
  int i;
};

b::b() {}

b::b(const b& c) { // { dg-bogus "base class .class a. should be explicitly initialized in the copy constructor" }
  i = c.i;
}

struct X {};

struct Y : X
{
  Y (Y const&) {}
};