Skip to content

Instantly share code, notes, and snippets.

@iains
Created May 19, 2026 23:17
Show Gist options
  • Select an option

  • Save iains/3a147b24a6a455426caae5ce438c8cd8 to your computer and use it in GitHub Desktop.

Select an option

Save iains/3a147b24a6a455426caae5ce438c8cd8 to your computer and use it in GitHub Desktop.
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 5f83991db83..b3940e1610c 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -433,10 +433,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (_M_is_local())
return;
-#ifdef __glibcxx_allocate_at_least // C++23
+#if __cpp_exceptions
+# ifdef __glibcxx_allocate_at_least // C++23
const size_type __limit = (__STDCPP_DEFAULT_NEW_ALIGNMENT__ - 1) / sizeof(_CharT);
-#else
+# else
const size_type __limit = 0;
+# endif
#endif
const size_type __length = length();
const size_type __capacity = _M_allocated_capacity;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment