[PATCH] D133853: [AST] Add msvc-specific C++11 attributes
S. B. Tam via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 8 05:05:59 PDT 2022
cpplearner added a comment.
In D133853#3808674 <https://reviews.llvm.org/D133853#3808674>, @aaron.ballman wrote:
> Now I'm wondering why the attribute exists at all. If it's functionally equivalent to `constexpr` as a keyword, what are the use cases for the attribute?
It appears that `[[msvc::constexpr]]` does not make a function `constexpr`, but if `[[msvc::constexpr]]` is used in a function definition //and// in a call to that function, then the annotated function call can be evaluated during constant evaluation: https://godbolt.org/z/3MPTsz6Yn
Apparently this is used to implement constexpr `std::construct_at`, which needs to call placement `operator new`, but the latter is not `constexpr`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133853/new/
https://reviews.llvm.org/D133853
More information about the cfe-commits
mailing list