mirror of
https://github.com/boostorg/static_string.git
synced 2026-01-19 04:42:12 +00:00
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: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113200>. If our CI shows we bump into that bug, we'll add a workaround.
This commit is contained in:
committed by
Gennaro Prota
parent
2f8c7a69ea
commit
a526ebd1f6
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user