Skip to content

Commit 55dff8c

Browse files
committed
Work around 'bug' in clang 5 C++17 overload resolution.
Clang 5.0, and hence current Cling, support for explicit conversion is still inadequate even in c++17 mode.
1 parent b7afbb6 commit 55dff8c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/base/inc/TString.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ friend Bool_t operator==(const TString &s1, const char *s2);
275275

276276
// Type conversion
277277
operator const char*() const { return GetPointer(); }
278-
#if __cplusplus >= 201700L
278+
#if (__cplusplus >= 201700L) && (!defined(__clang_major__) || __clang_major__ > 5)
279+
// Clang 5.0 support for explicit conversion is still inadequate even in c++17 mode.
280+
// (It leads to extraneous ambiguous overload errors)
279281
explicit operator std::string() const { return std::string(GetPointer(),Length()); }
280282
explicit operator ROOT::Internal::TStringView() const { return ROOT::Internal::TStringView(GetPointer(),Length()); }
281283
operator std::string_view() const { return std::string_view(GetPointer(),Length()); }

0 commit comments

Comments
 (0)