[libcxx-commits] [libcxx] [libcxx] Allow string to use SSO in constant evaluation. (PR #66576)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Sep 17 21:20:52 PDT 2023
================
@@ -1729,8 +1729,10 @@ private:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
bool __is_long() const _NOEXCEPT {
- if (__libcpp_is_constant_evaluated())
- return true;
+ if (__libcpp_is_constant_evaluated()) {
+ if (__builtin_constant_p(__r_.first().__l.__is_long_))
+ return __r_.first().__l.__is_long_;
+ }
----------------
philnik777 wrote:
```suggestion
if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__r_.first().__l.__is_long_)) {
return __r_.first().__l.__is_long_;
}
```
https://github.com/llvm/llvm-project/pull/66576
More information about the libcxx-commits
mailing list