[llvm-bugs] [Bug 30479] New: alignas and packed attribute not obeyed
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 21 12:28:28 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30479
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
Assignee: unassignedclangbugs at nondot.org
Reporter: david.jobet at free.fr
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
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
3.9.0)
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160921/e2bbf30c/attachment.html>
More information about the llvm-bugs
mailing list