[PATCH] D47956: [MS] Consder constexpr globals to be inline, as in C++17
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 20 15:30:28 PDT 2018
rnk added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:6597
+ (getLangOpts().CPlusPlus17 ||
+ Context.getTargetInfo().getCXXABI().isMicrosoft()))
NewVD->setImplicitlyInline();
----------------
thakis wrote:
> Is this related to /Zc:externConstexpr / PR36413? If so, maybe we should do the standards-conforming thing by default and ask people to pass /Zc:externConstexpr- if they need ABI compat?
>
> Want to add a FIXME about doing this in the AST in the source too?
The way I see it, doing the C++17 thing by default is in some ways more standards-conforming. We're opting people into the new rules earlier on this platform because we have to be ABI compatible with the other compiler.
Also, I think this is unrelated to /Zc:externConstexpr: "By default, Visual Studio always gives a constexpr variable internal linkage, even if you specify the extern keyword." That's not what we're doing here. We're marking these things inline, which means they will be merged across TUs, as they would if the user explicitly added __declspec(selectany).
https://reviews.llvm.org/D47956
More information about the cfe-commits
mailing list