| 1 |
// PR c++/109918 - Test covariant return types |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-additional-options -Woverloaded-virtual } |
| 4 |
|
| 5 |
struct Big { virtual ~Big () {} }; |
| 6 |
struct Smaller : Big {}; |
| 7 |
|
| 8 |
// Single inheritance case |
| 9 |
struct Foo { |
| 10 |
virtual Big* getMe() const; |
| 11 |
}; |
| 12 |
struct Bar : Foo { |
| 13 |
virtual Smaller* getMe() const; |
| 14 |
}; |
| 15 |
|
| 16 |
// Multiple inheritance case |
| 17 |
struct Troops { virtual ~Troops(); }; |
| 18 |
struct Control { |
| 19 |
virtual Big* GetControl() const; |
| 20 |
}; |
| 21 |
struct Army : Troops, Control { |
| 22 |
virtual Smaller* GetControl() const; |
| 23 |
}; |