[libcxx-commits] [libcxx] [libc++] P3391R2: `constexpr` integral overloads of `to_(w)string` (PR #205025)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 30 01:48:21 PDT 2026
================
@@ -3774,12 +3777,15 @@ stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI double stod(const string& __str, size_t* __idx = nullptr);
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long double stold(const string& __str, size_t* __idx = nullptr);
+# if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_BUILDING_LIBRARY)
----------------
frederick-vs-ja wrote:
`[[gnu::noinline]]` doesn't seem able to enforce generating an out-of-line definition in dylib when the function is `constexpr`. Maybe we can have another function in dylib to call the `constexpr`-ized `to_string` functions, but if that function is optimized out, the out-of-line definitions will also be eliminated.
(Microsoft's `__declspec(dllexport)` can keep out-of-line definitions even when they're `constexpr`, but I haven't found similar approach for other platforms.)
It seems that we can't reasonably mark the function definitions seen by dylib `constexpr`.
https://github.com/llvm/llvm-project/pull/205025
More information about the libcxx-commits
mailing list