efriedma added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:14254
int SectionFlags = ASTContext::PSF_Read;
- if (var->getType().isConstQualified()) {
- if (HasConstInit)
----------------
rnk wrote:
> I think this is not compatible with MSVC. MSVC uses simple logic, it doesn't
> look for mutable: https://gcc.godbolt.org/z/sj6d4saxx
>
> The const mutable struct appears in the myrdata section in that example.
>
> I think the solution is to separate the flag logic from the pragma stack
> selection logic, which has to remain MSVC-compatible.
MSVC apparently looks at whether the variable is marked "const", and nothing
else; it doesn't look at mutable, it doesn't look at whether the variable has a
constant initializer. So the current code isn't right either; if we're trying
to implement MSVC-compatible logic, we shouldn't check HasConstInit.
That said, I'm not sure how precisely/in what modes we want to precisely
emulate MSVC. Probably anything we do here will be confusing.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156726/new/
https://reviews.llvm.org/D156726
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits