aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr79085.C
blob: 1d75d6a730094f105e8ec1aef213df7714184b90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// PR c++/79085
// { dg-do compile }
// { dg-options "-Os" }
// { dg-additional-options "-mstrict-align" { target { aarch64*-*-* powerpc*-*-linux* powerpc*-*-elf* } } }

void *operator new (__SIZE_TYPE__, void *p) { return p; }

struct S
{
  S ();
  S (const S &);
  ~S (void);
  int i;
};

S foo ();

static char buf [sizeof (S) + 1];

S *
bar ()
{
  return new (buf + 1) S (foo ());
}