https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68267

            Bug ID: 68267
           Summary: over-aligning with alignas() doesn't work
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

markus@x4 /tmp % cat test.cpp
#include <cstddef>
static constexpr std::size_t alignment = 256;
struct alignas(alignment) foo {
  char c;
};
static_assert(alignof(foo) == alignment, "");

markus@x4 /tmp % icpc -c -std=c++14 test.cpp
markus@x4 /tmp % clang++ -c -std=c++14 test.cpp
markus@x4 /tmp % g++ -c -std=c++14 test.cpp
test.cpp:3:27: warning: requested alignment 256 is larger than 128
[-Wattributes]
 struct alignas(alignment) foo {
                           ^
test.cpp:6:1: error: static assertion failed: 
 static_assert(alignof(foo) == alignment, "");
 ^

Reply via email to