gcc/testsuite/g++.dg/other/final7.C
raw| 1 | // PR c++/90909 |
| 2 | // { dg-do run { target c++11 } } |
| 3 | // { dg-skip-if "requires hosted libstdc++ for cassert" { ! hostedlib } } |
| 4 | |
| 5 | #include <cassert> |
| 6 | |
| 7 | struct S1 { virtual bool f() { return false; } }; |
| 8 | struct S2: S1 { virtual bool f() { return true; } }; |
| 9 | struct S3: S2 { using S1::f; }; |
| 10 | struct S4 final: S3 { void g(); }; |
| 11 | void S4::g() { assert (f() == true); } |
| 12 | int main() { S4().g(); } |