[libcxx-commits] [PATCH] D116487: [libc++][NFC] Introduce __fits_in_sso()

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 3 13:15:44 PST 2022


ldionne added a comment.

In D116487#3218194 <https://reviews.llvm.org/D116487#3218194>, @philnik wrote:

> You have to deallocate anything that you allocated during constant evaluation. So using a constexpr string in a non-constexpr context is illegal IIUC. https://godbolt.org/z/KKv3YnP4a

Right, it looks like I got confused with promotion to static storage, which was pulled from the paper IIRC.

So I think this works, however if/when we allow something like `constexpr std::string s = "hello";` at file scope (which entails that we'll do some sort of promotion of the constexpr-allocated memory to static storage), we'll have to tackle this problem cause the possibility of `__fits_in_sso()` lying is going to become real. For the time being, no problem though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116487/new/

https://reviews.llvm.org/D116487



More information about the libcxx-commits mailing list