| 1 |
// PR5645: gcc warns that pure virtual class not explicitly initialized. |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-Wall -Wextra" } |
| 4 |
|
| 5 |
class a { |
| 6 |
public: |
| 7 |
virtual int f() = 0; |
| 8 |
virtual int g() = 0; |
| 9 |
}; |
| 10 |
|
| 11 |
class b : public a { |
| 12 |
public: |
| 13 |
b(); |
| 14 |
b(const b& c); |
| 15 |
|
| 16 |
protected: |
| 17 |
int i; |
| 18 |
}; |
| 19 |
|
| 20 |
b::b() {} |
| 21 |
|
| 22 |
b::b(const b& c) { // { dg-bogus "base class .class a. should be explicitly initialized in the copy constructor" } |
| 23 |
i = c.i; |
| 24 |
} |
| 25 |
|
| 26 |
struct X {}; |
| 27 |
|
| 28 |
struct Y : X |
| 29 |
{ |
| 30 |
Y (Y const&) {} |
| 31 |
}; |
| 32 |
|