<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54393>54393</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang15 (development) alignas(void) gives confusing error message
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rollbear
</td>
</tr>
</table>
<pre>
With:
clang version 15.0.0 (https://github.com/llvm/llvm-project.git 87ec6f41bba6d72a3408e71cf19ae56feff523bc)
flags: -std=c++20 -Wall -Wextra -Wpedantic
Simplest straight forward case:
```C++
struct alignas(void) S{};
```
Gives the error message:
```
error: invalid application of 'alignof' to an incomplete type 'void'
struct alignas(void) S{};
~^~~~~
```
There is no `alignof` in the sources, and to most users `void` is not an incomplete type, it's just a weird one.
Less obvious, as a template:
```C++
template <typename T>
struct alignas(T) S {};
S<void> s;
```
error: invalid application of 'alignof' to an incomplete type 'void'
struct alignas(T) S {};
^~
:4:9: note: in instantiation of template class 'S<void>' requested here
S<void> s;
^
Same problem, except the use in a template is probably more likely.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9VMty2zAM_BrqgolGT8s66BDHTi-9JTM5UxQkM6VElaSc-O8LSrVrp0mmudRDUy-AWGAXqHVzrJ6k27P0lkVbFt0KxYcODmis1APEeRiFEbBkvXdutN4quafVkctUh0L39KDU4XS5GY1-RuFCMoB1gWLVZnFd81VTJDzNojUWsWjjkmO-arFt8yStBUvKJfayt4p3PhLAjXUNS7dksKGVRHDzxJWiHV-d4XQdseGDk-LS_UH2o0LrwJKN7PYOWm1euGlAcIvnPH_vq2hZd0uM5S15TsIBV7IbuKXkD1o2hBIeWLFhxZalmzful2d-kwe04PYIaIw20KO1vPsw8vI4m_qk5XCguA3wcVRScOdZ0C0xUMxwdEt34DTwgUyp_pSrQ3DHEb3NArT4Yhpw9WPFjuU7v5_Xx8k-7tEgSAuDBvp0wriKCN1cA6snI5Ci3xHkxiPvNZEzWVKY95gxeXN_hHsnLe8pHSVl4XkiTw4vKIlNPWB4ieQ7lRl0fZB6WqJZMnVIJ3H3b7SfjIGldz7ywHuER5buPijn41xLeKuJRYV0xpxaugP7uV7-C_XvY4U3zOcXbKe3Gf1LD4yIwQUgLet8y53RnYtGg4MIIAQXqXvABn9O1I7YgJfKZ9W5hHH9YnHydNB8qRX2nmB8FTi6WWSkJg_uD99eTt6U1-pIgiOJKvkD1fFKMUFTpU2Zljxw0ims5tEX537aNXhApcceB-cL93cLdXOTCz20k5U0MK9aPZiMqr42MOlRWjv5RrnPs7RMg32Vl2WzjnmxTtpIZBnHum1SLFq-ElGyrutA8RqVrVi-Yfk2kFUSJUmUxjRUszjJw6JM4kgUyZpjs0YsWRZhz6UKfeBQmy4w1YyhnmjgZpGS1tk_H4lOyhrxdD6f3F6bymilauQmmPFWM9hf_HTdcg">