[llvm] [libcxx] Allow string to use SSO in constant evaluation. (PR #66576)
Shafik Yaghmour via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 26 18:34:23 PDT 2023
================
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// Ensure that strings which fit within the SSO size can be constant-initialized
----------------
shafik wrote:
I think I would also like to see some Sema tests as well, do we expect something like this to work: https://godbolt.org/z/x8EvdGfoq
Currently it does not for libstdc++ but does on MSVC.
```cpp
#include <string>
constexpr std::string f() {
std::string s = "hello world";
return s;
}
void g() {
constexpr auto s = f();
}
```
https://github.com/llvm/llvm-project/pull/66576
More information about the llvm-commits
mailing list