gcc/testsuite/g++.dg/init/cleanup2.C
raw| 1 | // PR c++/12526 |
| 2 | |
| 3 | // We decided that the call to strcmp has no side-effects because strcmp is |
| 4 | // pure, even though the first argument has side-effects. As a result, we |
| 5 | // stripped the CLEANUP_POINT_EXPR. Hilarity ensued. |
| 6 | |
| 7 | extern "C" int strcmp (const char *, const char *); |
| 8 | |
| 9 | struct A { |
| 10 | A(int); |
| 11 | const char *str(); |
| 12 | ~A(); |
| 13 | }; |
| 14 | |
| 15 | void printQueryI() |
| 16 | { |
| 17 | if(!strcmp(A(1).str(), "foo")) |
| 18 | { } |
| 19 | } |