gcc/testsuite/g++.dg/opt/pr20991.C
raw| 1 | // PR middle-end/20991 |
| 2 | // { dg-options "-O2" } |
| 3 | // { dg-do compile } |
| 4 | |
| 5 | struct S |
| 6 | { |
| 7 | virtual inline int foo () const; |
| 8 | virtual inline bool bar () const; |
| 9 | virtual int baz (int) const; |
| 10 | }; |
| 11 | |
| 12 | inline int S::foo () const |
| 13 | { |
| 14 | return 1; |
| 15 | } |
| 16 | |
| 17 | inline bool S::bar () const |
| 18 | { |
| 19 | return foo () == 0; |
| 20 | } |
| 21 | |
| 22 | void A () |
| 23 | { |
| 24 | S s; |
| 25 | if (s.bar ()) |
| 26 | s.foo (); |
| 27 | } |
| 28 | |
| 29 | void B () |
| 30 | { |
| 31 | S s; |
| 32 | if (s.bar ()) |
| 33 | s.foo (); |
| 34 | } |