[Bug c++/94124] [10 Regression] conversion from ‘<brace-enclosed initializer list>’ to ‘F’ is ambiguous since r10-6388-ge98ebda074bf8fc5
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 10 21:10:59 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94124
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This is a bad interaction between sharing a constructor for an array and
stripping trailing zero-initializers, which is why this test works with
{{{1}}}.
While here you can initialize D from {{}}, you can't initialize it from {{0}}.
So when we drop that 0, we suddenly allow both F() overloads, making this
ambiguous.
Slightly tweaked testcase:
template <int N> struct A { typedef int _Type[N]; };
template <int N> struct B { typename A<N>::_Type _M_elems; };
class C { };
struct D {
D(C);
};
struct F {
F(B<2>);
F(D);
};
F fn1() { return {{{0}}}; }
More information about the Gcc-bugs
mailing list