From 961251407f50b59079c46fee97d3c6f26065f501 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 29 Jul 2026 19:14:20 +0000 Subject: [PATCH] Fix string_view brace-init ambiguity in string_view(const std::string&) GCC 16/libstdc++'s constrained iterator-pair basic_string_view(_It, _End) constructor makes std::string_view{s} ambiguous under overload resolution when s is a std::string, breaking the ppc-darwin/g++-mp-16 build. Use the (data, size) constructor directly instead of relying on brace-init going through std::string's implicit conversion operator. Also add the missing include: this header only ever saw std::string as an incomplete forward-declared type (via 's pull-in), which happened to work for the old brace-init form on some stdlibs but fails outright once .data()/.size() are called on it. --- eden/common/utils/String.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eden/common/utils/String.h b/eden/common/utils/String.h index 3a9366c..74f17e7 100644 --- eden/common/utils/String.h +++ eden/common/utils/String.h @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include @@ -64,7 +65,7 @@ constexpr bool ends_with( struct string_view : std::string_view { /*implicit*/ string_view(const std::string& s) noexcept - : std::string_view{s} {} + : std::string_view(s.data(), s.size()) {} /*implicit*/ string_view(std::string_view sv) noexcept : std::string_view{sv} {} using std::string_view::string_view;