Skip to content

Commit 2b85a5e

Browse files
committed
GCC 16 warns that WTF::String was incomplete in a SFINAE context
https://bugs.webkit.org/show_bug.cgi?id=328859 Reviewed by Darin Adler. PrintStream.h defines printInternal(PrintStream&, String&) inline, before String is complete. Overload resolution in its body checks whether String converts to std::span<const char8_t>, which runs the ranges concepts on the incomplete type, so every file including WTFString.h warns with -Wsfinae-incomplete. Move the overload out of line. * Source/WTF/wtf/PrintStream.cpp: (WTF::printInternal): * Source/WTF/wtf/PrintStream.h: Canonical link: https://commits.webkit.org/324672@main
1 parent d56b5fc commit 2b85a5e

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎Source/WTF/wtf/PrintStream.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ void printInternal(PrintStream& out, const String& string)
147147
printExpectedCStringHelper(out, "String", string.tryGetUTF8());
148148
}
149149

150+
void printInternal(PrintStream& out, String& string)
151+
{
152+
printInternal(out, static_cast<const String&>(string));
153+
}
154+
150155
void printInternal(PrintStream& out, const AtomString& string)
151156
{
152157
printExpectedCStringHelper(out, "String", string.string().tryGetUTF8());

‎Source/WTF/wtf/PrintStream.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ WTF_EXPORT_PRIVATE void printInternal(PrintStream&, const StringImpl*);
127127
WTF_EXPORT_PRIVATE void printInternal(PrintStream&, std::span<const char8_t>);
128128
WTF_EXPORT_PRIVATE void printInternal(PrintStream&, const char8_t*);
129129
inline void printInternal(PrintStream& out, char* value) { printInternal(out, static_cast<const char*>(value)); }
130-
inline void printInternal(PrintStream& out, String& value) { printInternal(out, static_cast<const String&>(value)); }
130+
WTF_EXPORT_PRIVATE void printInternal(PrintStream&, String&);
131131
inline void printInternal(PrintStream& out, StringImpl* value) { printInternal(out, static_cast<const StringImpl*>(value)); }
132132

133133
WTF_EXPORT_PRIVATE void printInternal(PrintStream&, bool);

0 commit comments

Comments
 (0)