view gcc/testsuite/g++.dg/cpp0x/gen-attrs-54.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR c++/56859
// { dg-require-effective-target c++11 }

template<unsigned size, unsigned alignment>
struct aligned_storage
{
  using type = struct { alignas(alignment) unsigned char data[size]; };
};

#define SA(X) static_assert((X),#X)
SA(alignof(aligned_storage<8,1>::type) == 1);
SA(alignof(aligned_storage<8,2>::type) == 2);
SA(alignof(aligned_storage<8,4>::type) == 4);
SA(alignof(aligned_storage<8,8>::type) == 8);