-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Initializer list constructors cause ambiguous overloads in application code #24093
Comments
Yes, I'm afraid this change shouldn't have been backported as it broke a lot of code and it could have been foreseen. Unfortunately now that it is, we're not going to remove it as it would make the matters even worse, so the only fix is to work around it in the application code by using the explicit conversion from the initializer list to whichever class you want to use. E.g. in your case you'd use Test(wxArrayString({ std::string("Hello, world") })); or Test(std::vector<std::string>({ std::string("Hello, world") })); depending on what the intention is (the latter would restore the previous behaviour). We could also allow predefining some |
Thanks for the explanation! I worked around the issue with an explicit |
It's not going to be removed in the observable future, there is just too much code using it and it still must be used in some places in wx API. The plan/hope is to get rid of these remaining places and it's, of course, recommended not to use it in any new code, but removing it would break way too many code bases, so it's not going to happen any time soon. |
Provide a way to disable the new ctors taking std::initializer_list added in 3.1.4 as they can break compilation of the existing code. Closes wxWidgets#24093.
Provide a way to disable the new ctors taking std::initializer_list added in 3.1.4 as they can break compilation of the existing code. Closes wxWidgets#24093.
Description
Bug description:
In wxWidgets 3.2.4, support for C++ initializer lists in certain type constructors was introduced. (PR: #23309 )
This causes problems in 3rd party code, where transitive constructors are overloaded with other types that take initializer lists.
Specifically, PrusaSlicer fails to build with 3.2.4.
Expected vs observed behaviour:
Code like this should compile:
This compiled fine with wxWidgets 3.2.3, but with 3.2.4, g++ reports the following error (gcc 13.2.0):
Potential fixes:
Curiously, I expected that making the initializer list constructors explicit would help, but the transitive overload is still considered ambiguous by gcc:
Platform and version information
The text was updated successfully, but these errors were encountered: