gcc/testsuite/g++.dg/opt/pr79085.C
raw| 1 | // PR c++/79085 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-Os" } |
| 4 | // { dg-additional-options "-mstrict-align" { target { aarch64*-*-* powerpc*-*-linux* powerpc*-*-elf* } } } |
| 5 | |
| 6 | void *operator new (__SIZE_TYPE__, void *p) { return p; } |
| 7 | |
| 8 | struct S |
| 9 | { |
| 10 | S (); |
| 11 | S (const S &); |
| 12 | ~S (void); |
| 13 | int i; |
| 14 | }; |
| 15 | |
| 16 | S foo (); |
| 17 | |
| 18 | static char buf [sizeof (S) + 1]; |
| 19 | |
| 20 | S * |
| 21 | bar () |
| 22 | { |
| 23 | return new (buf + 1) S (foo ()); |
| 24 | } |