gcc/testsuite/g++.dg/cpp0x/pr77907.C
raw| 1 | // PR c++/77907 |
| 2 | // { dg-do run { target c++11 } } |
| 3 | // { dg-options "-O2 -save-temps" } |
| 4 | // { dg-final { scan-assembler-not "static_initialization" } } |
| 5 | |
| 6 | struct A { |
| 7 | int foo () { return 1; } |
| 8 | }; |
| 9 | |
| 10 | struct B { |
| 11 | using C = int (A::*) (); |
| 12 | constexpr explicit B (const C x) : b{x} {} |
| 13 | C b; |
| 14 | }; |
| 15 | |
| 16 | B b{&A::foo}; |
| 17 | |
| 18 | int |
| 19 | main () |
| 20 | { |
| 21 | if (!b.b) |
| 22 | __builtin_abort (); |
| 23 | } |