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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to