gcc/testsuite/g++.dg/cpp0x/constexpr-static3.C
raw| 1 | // Test for constant initialization of class with vtable |
| 2 | // { dg-options "-save-temps" } |
| 3 | // { dg-final { scan-assembler-not "static_initialization" } } |
| 4 | // { dg-do run { target c++11 } } |
| 5 | |
| 6 | int r = 1; |
| 7 | // implicit default constructor for A and B is constexpr |
| 8 | struct A { virtual void f() {} }; |
| 9 | struct B: A { virtual void f() { r = 0; } }; |
| 10 | |
| 11 | B b; |
| 12 | |
| 13 | int main() |
| 14 | { |
| 15 | b.f(); |
| 16 | return r; |
| 17 | } |