Diagnose when an explicit alignment is weakened by other features
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This was split off from a comment in #58638:
> We might want to open another somewhat similar issue to diagnose when `alignas` is weakened by something else:
> ```cpp
> #pragma pack(2)
> struct D2 {
> char m1;
> alignas(8) int m4;
> };
>
> static_assert(alignof(D2) == 2); // Clang and GCC accept, MSVC and EDG reject
> ```
Contributor guide
Research direction
Start by reproducing the provided C++ snippet and comparing how Clang handles alignas with #pragma pack against the behavior noted for GCC, MSVC, and EDG. Trace the compiler path responsible for alignment diagnostics; done means an explicit alignment weakened by another feature is diagnosed consistently, with a regression test for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100