1 //===---------------- exception_object_alignment.pass.cpp -----------------===//
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 // Check that the pointer __cxa_allocate_exception returns is aligned to the
12 // default alignment for the target architecture.
17 #include <type_traits>
18 #include <__cxxabi_config.h>
22 } __attribute__((aligned
));
25 #if !defined(_LIBCXXABI_ARM_EHABI)
26 void *p
= __cxxabiv1::__cxa_allocate_exception(16);
27 auto i
= reinterpret_cast<uintptr_t>(p
);
28 auto a
= std::alignment_of
<S
>::value
;
30 __cxxabiv1::__cxa_free_exception(p
);