From a526ebd1f680d347ddaa672c71034347f265eed0 Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Mon, 15 Dec 2025 16:26:53 +0100 Subject: [PATCH] Check that basic_static_string can be constructed and assigned from a C-style string in a constexpr context This triggers a libstdc++ issue which was fixed in GCC 12.4 and 13.3: . If our CI shows we bump into that bug, we'll add a workaround. --- test/constexpr_tests.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/constexpr_tests.hpp b/test/constexpr_tests.hpp index 3517488..7c6ab12 100644 --- a/test/constexpr_tests.hpp +++ b/test/constexpr_tests.hpp @@ -67,6 +67,22 @@ bool testConstantEvaluation() { #ifdef BOOST_STATIC_STRING_CPP20 + + // Check construction in a constexpr context + constexpr basic_static_string s("hello"); + static_assert(s.size() == 5); + static_assert(s == "hello"); + + // Check assignment in a constexpr context + constexpr auto s2 = + []() + { + basic_static_string s("hello"); + s = "world"; + return s; + }(); + static_assert(s2 == "world"); + // c++20 constexpr tests cstatic_string a; cstatic_string b(1, 'a');