view gcc/testsuite/g++.dg/opt/pr79085.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line source

// 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 ());
}