<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - alignas and packed attribute not obeyed"
href="https://llvm.org/bugs/show_bug.cgi?id=30479">30479</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>alignas and packed attribute not obeyed
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.jobet@free.fr
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>