blob: 0011390093281b718b913969046f9920077b3c1c (
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
25
26
27
28
29
30
31
|
// PR c++/102071
// { dg-do run { target { { c++17 } && { ! default_packed } } } }
// { dg-additional-options -faligned-new=2 }
// { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
#include <new>
int nalign;
void *operator new (std::size_t s, std::align_val_t a)
{
nalign = (int)a;
return operator new (s);
}
struct X { ~X(); int c; };
int align = (alignof (X) > alignof (std::size_t)
? alignof (X) : alignof (std::size_t));
int n = 4;
int main()
{
X *p = new X[n];
if (nalign != align)
__builtin_abort ();
X *p2 = new X;
if (nalign != alignof (X))
__builtin_abort ();
}
|