gcc/testsuite/g++.dg/torture/pr60315.C
raw| 1 | // PR ipa/60315 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-std=c++11" } |
| 4 | |
| 5 | struct Base { |
| 6 | virtual int f() = 0; |
| 7 | }; |
| 8 | |
| 9 | struct Derived : public Base { |
| 10 | virtual int f() final override { |
| 11 | return 42; |
| 12 | } |
| 13 | }; |
| 14 | |
| 15 | extern Base* b; |
| 16 | |
| 17 | int main() { |
| 18 | return (static_cast<Derived*>(b)->*(&Derived::f))(); |
| 19 | } |