Issue 183670
Summary [Clang] `alignof(nullptr_t)` is inconsistent with MSVC when using MSVC ABI
Labels clang:frontend, clang:codegen, ABI, platform:windows, diverges-from:msvc
Assignees
Reporter frederick-vs-ja
    Currently, Clang sets `alignof(nullptr_t)` equal to `alignof(void*)` when using MSVC ABI, but MSVC sets `alignof(nullptr_t)` to 1. [Godbolt link](https://godbolt.org/z/qj6TPWf3v). It seems that if one explicitly uses `alignof(nullptr_t)` or `alignas(nullptr_t)`, there would be source and/or ABI incompatibility with MSVC.

I think Clang's behavior is desired and consistent with C23 requirements (see also [CWG2966](https://cplusplus.github.io/CWG/issues/2966.html)). Also, MSVC seemingly treats `nullptr_t` as something aligned as `void*` when calculating class layout, which is a bit weird.

Do we want to get closer to MSVC or inform MSVC to change?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to