1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-exceptions
11 // The situation for the alignment of exception objects is badly messed up
12 // before macOS 10.14. The test fails on macOS 10.9 to 10.12, passes on macOS
13 // 10.13 (no investigation done), and passes afterwards. Just mark all the OSes
14 // before 10.14 as unsupported.
15 // UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13}}
17 // Check that the pointer __cxa_allocate_exception returns is aligned to the
18 // default alignment for the target architecture.
23 #include <type_traits>
24 #include <__cxxabi_config.h>
28 } __attribute__((aligned
));
30 int main(int, char**) {
31 #if !defined(_LIBCXXABI_ARM_EHABI)
32 void *p
= __cxxabiv1::__cxa_allocate_exception(16);
33 auto i
= reinterpret_cast<uintptr_t>(p
);
34 auto a
= std::alignment_of
<S
>::value
;
36 __cxxabiv1::__cxa_free_exception(p
);