gcc/testsuite/g++.old-deja/g++.jason/warning5.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-options "-Wall" } |
| 3 | // PRMS Id: 5135 |
| 4 | // Bug: g++ complains that the result of the new expression is not used. |
| 5 | |
| 6 | extern "C" int printf (const char *, ...); |
| 7 | inline void * operator new (__SIZE_TYPE__, void *p) { return p; } |
| 8 | |
| 9 | class foo { |
| 10 | public: |
| 11 | foo() : a(42) {}; |
| 12 | int a; |
| 13 | }; |
| 14 | |
| 15 | int |
| 16 | main() |
| 17 | { |
| 18 | char buffer[1024]; |
| 19 | |
| 20 | new (buffer) foo; |
| 21 | |
| 22 | foo* pY = (foo *)buffer; |
| 23 | |
| 24 | return pY->a != 42; |
| 25 | } |