1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-ipa-icf -fdump-tree-dom2" } */
3 
4 #include <new>
5 
6 struct Foo {
FooFoo7   Foo() { i[0] = 1; }
8   int i[2];
9 };
10 
foo_char(void)11 int foo_char(void)
12 {
13   int i[2];
14   new (reinterpret_cast<char *>(i)) Foo();
15   return reinterpret_cast<Foo *>(i)->i[0];
16 }
17 
foo_void(void)18 int foo_void(void)
19 {
20   int i[2];
21   new (reinterpret_cast<void *>(i)) Foo();
22   return reinterpret_cast<Foo *>(i)->i[0];
23 }
24 
foo_void_offset(void)25 int foo_void_offset(void)
26 {
27   int i[2];
28   new (reinterpret_cast<void *>(&i[0])) Foo();
29   return reinterpret_cast<Foo *>(&i[0])->i[0];
30 }
31 
32 /* { dg-final { scan-tree-dump-times "return 1;" 3 "dom2" } } */
33