diff --git a/libcxx/include/string b/libcxx/include/string index c676182fba8ba..e2be53eaee241 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -922,7 +922,7 @@ public: // Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS // does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first. // __str's memory needs to be unpoisoned only in the case where it's a short string. - : __r_(((__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)), std::move(__str.__r_))) { + : __r_([](basic_string &__s){ if(!__s.__is_long()) __s.__annotate_delete(); return std::move(__s.__r_); }(__str)) { __str.__r_.first() = __rep(); __str.__annotate_new(0); if (!__is_long())