c++: Fix wrong conversion error with non-viable overload [PR94124]
This is a bad interaction between sharing a constructor for an array and stripping its trailing zero-initializers. Here we reuse a ctor and then strip its 0s. This breaks overload resolution in this test: D can be initialized from {} but not from {0}, so if we truncate the constructor not to include the zero, the F(D) overload becomes valid and then we get the ambiguous conversion error. PR c++/94124 - wrong conversion error with non-viable overload. * decl.c (reshape_init_array_1): Unshare a constructor if we stripped trailing zero-initializers. * g++.dg/cpp0x/initlist-overload1.C: New test.
Showing
Please
register
or
sign in
to comment