Bug ID: 30479
           Summary: alignas and packed attribute not obeyed
           Product: clang
           Version: 3.9
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
    Classification: Unclassified

Here's the test case :
#include <cstdint>
#include <cstddef>

struct alignas(128) test
  uint8_t  v;
  uint64_t s;
} __attribute__((__packed__));

int main(int argc, char** argv)
  struct test t;
  static_assert(offsetof(test, s) == 1, "Bug on!");
  return 0;
And here's the output :
$ clang++  -std=c++11 test.cpp 
test.cpp:13:3: error: static_assert failed "Bug on!"
  static_assert(offsetof(test, s) == 1, "Bug on!");
  ^             ~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
$ clang++ --version
TPM built 20160902 clang version 3.9.0 (tags/RELEASE_390/final) (based on LLVM
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: [redacted]
While it compiles fine with gcc and icc :
$ g++  -std=c++11 test.cpp
$ g++ --version
g++ (TPM built 20160719) 5.4.0

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to