-
-
Notifications
You must be signed in to change notification settings - Fork 844
ICU-23271 Fix a possible error about ambiguous overloads of U_ICU_NAMESPACE::internal::toU16StringView
#3786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
ICU-23271 Fix a possible error about ambiguous overloads of U_ICU_NAMESPACE::internal::toU16StringView
#3786
Conversation
…2668: 'sbicu_77::internal::toU16StringView': ambiguous call to overloaded function` when compiling with visual studio 2022 when calling `template<typename S, typename = std::enable_if_t<ConvertibleToU16StringView<S>>> UnicodeString::operator+(const UnicodeString&, const S&)` w/ `S` being a subclass of `UnicodeString`
…iewNullable` overloads (didn't notice these _weren't_ called `toU16StringView` earlier) from previous commit
icu_77::internal::toU16StringViewU_ICU_NAMESPACE::::internal::toU16StringView
U_ICU_NAMESPACE::::internal::toU16StringViewU_ICU_NAMESPACE::internal::toU16StringView
…rs related to my recent change (It's a bit strange it worked when _using_ the header from our code?)
|
I have a reproducer (linked in OP), not sure how to fit it into your tests, any guidance? Also, it won't fail after the change, so I'm not sure exactly how it should work?
I saw
Templates are implicitly |
…` in favour of direct use of `std::is_convertible_t` definition based on PR comment.
|
You mention that the issue occurs when (emphasis mine)
The documentation explicitly says icu/icu4c/source/common/unicode/unistr.h Line 232 in 9f1c574
So I think we would want to see a reproducible issue without subclassing UnicodeString before we start playing around with this overload set. |
|
(Incidentally, since this has been possible since C++11, we might want to make UnicodeString final, instead of saying that you should not subclass it in the middle of a hundred-line comment.) EDIT: filed ICU-23284. |
Ahh, if the official word is that subclassing is not allowed, I guess we'll have to change our implementation strategy... A bit problematic since I was relying on this being possible to accomplish some |
See https://unicode-org.atlassian.net/browse/ICU-23271 & matthew-wozniczka/icu-23271-reproducer@9c8cf8a (Note: For the latter, use the HEAD of the main branch to test)
When using ICU (noticed in the 77.1 release, didn't seem to be an issue in 74.2) in a configuration where the encoding of
wchar_tis UTF-16 (noticed on 32-bit AIX & Windows), using the+=operator on a subclass ofUnicodeStringcould give a compilation error about an ambiguous reference toU_ICU_NAMESPACE::internal::toU16StringViewI fixed it (at least for our use-case) by modifying the overload meant to handle
std::u16string_viewitself to also handle any types which are implicitly convertible to it (asUnicodeStringis)Checklist