llvm / llvm/llvm-project

Incorrect alignment in MSVC compatibility mode

Open
#196,308 4 comments 0 reactions 0 assignees View on GitHub
c++11 confirmed diverges-from:msvc platform:windows
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Consider the following example (https://godbolt.org/z/r5qG5vE9n):
```cpp
struct alignas(8) B;
struct B { alignas(4) int i; }; // Clang rejects, MSVC accepts
static_assert(alignof(B) == 4); // Clang rejects, MSVC accepts
```
This is accepted by MSVC (with a warning), but is reject by Clang even with an `x86_64-pc-windows-msvc` target triple.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.