gcc/testsuite/g++.dg/torture/pr53336.C
raw| 1 | // { dg-do compile } |
| 2 | |
| 3 | bool foo(); |
| 4 | |
| 5 | struct C |
| 6 | { |
| 7 | C() |
| 8 | { |
| 9 | if (foo()) |
| 10 | foo(); |
| 11 | } |
| 12 | }; |
| 13 | |
| 14 | struct S |
| 15 | { |
| 16 | struct dummy |
| 17 | { |
| 18 | int i_; |
| 19 | }; |
| 20 | typedef int dummy::*bool_type; |
| 21 | |
| 22 | operator bool_type() const |
| 23 | { |
| 24 | return foo() ? &dummy::i_ : 0; |
| 25 | } |
| 26 | }; |
| 27 | |
| 28 | int x; |
| 29 | |
| 30 | struct adaptor |
| 31 | { |
| 32 | C c; |
| 33 | |
| 34 | virtual void bar() |
| 35 | { |
| 36 | if (S()) |
| 37 | x = 0; |
| 38 | } |
| 39 | }; |
| 40 | |
| 41 | int main() |
| 42 | { |
| 43 | adaptor a; |
| 44 | } |
| 45 |