#include <cstddef>
#define alignas(...) __attribute__((__aligned__(alignof(decltype(::wheels::detail::get_type_with_alignment<__VA_ARGS__>())))))
namespace wheels {
namespace detail {
template < std:: size_t N> struct __attribute__( ( __aligned__( N) ) ) alignment_type { } ;
template < typename T> T get_type_with_alignment( ) ;
template < std:: size_t N> alignment_type< N> get_type_with_alignment( ) ;
}
}
struct alignas( 8 ) foo { } ;
struct alignas( int ) bar { } ;
struct qux {
alignas( 2 ) char frob;
} ;
static_assert( alignof( foo) == 8 , "" ) ;
static_assert( alignof( bar) == alignof( int ) , "" ) ;
static_assert( alignof( qux) == 2 , "" ) ;
int main( ) { }
I2luY2x1ZGUgPGNzdGRkZWY+CiAKI2RlZmluZSBhbGlnbmFzKC4uLikgX19hdHRyaWJ1dGVfXygoX19hbGlnbmVkX18oYWxpZ25vZihkZWNsdHlwZSg6OndoZWVsczo6ZGV0YWlsOjpnZXRfdHlwZV93aXRoX2FsaWdubWVudDxfX1ZBX0FSR1NfXz4oKSkpKSkpCiAKbmFtZXNwYWNlIHdoZWVscyB7CiAgICBuYW1lc3BhY2UgZGV0YWlsIHsKICAgICAgICB0ZW1wbGF0ZSA8c3RkOjpzaXplX3QgTj4gc3RydWN0IF9fYXR0cmlidXRlX18oKF9fYWxpZ25lZF9fKE4pKSkgYWxpZ25tZW50X3R5cGUge307CiAgICAgICAgdGVtcGxhdGUgPHR5cGVuYW1lIFQ+IFQgZ2V0X3R5cGVfd2l0aF9hbGlnbm1lbnQoKTsKICAgICAgICB0ZW1wbGF0ZSA8c3RkOjpzaXplX3QgTj4gYWxpZ25tZW50X3R5cGU8Tj4gZ2V0X3R5cGVfd2l0aF9hbGlnbm1lbnQoKTsKICAgIH0KfQogCnN0cnVjdCBhbGlnbmFzKDgpIGZvbyB7fTsKc3RydWN0IGFsaWduYXMoaW50KSBiYXIge307CiAKc3RydWN0IHF1eCB7CiAgICBhbGlnbmFzKDIpIGNoYXIgZnJvYjsKfTsKIApzdGF0aWNfYXNzZXJ0KGFsaWdub2YoZm9vKSA9PSA4LCAiIik7CnN0YXRpY19hc3NlcnQoYWxpZ25vZihiYXIpID09IGFsaWdub2YoaW50KSwgIiIpOwpzdGF0aWNfYXNzZXJ0KGFsaWdub2YocXV4KSA9PSAyLCAiIik7CiAKaW50IG1haW4oKSB7fQo=
compilation info
prog.cpp: In instantiation of 'wheels::detail::alignment_type<8u>':
prog.cpp:13:8: instantiated from here
prog.cpp:7:88: error: requested alignment is not a constant
prog.cpp: In instantiation of 'wheels::detail::alignment_type<2u>':
prog.cpp:17:5: instantiated from here
prog.cpp:7:88: error: requested alignment is not a constant
prog.cpp:20:1: error: static assertion failed: ""
prog.cpp:22:1: error: static assertion failed: ""
stdout