https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94124
Bug ID: 94124
Summary: [10 Regression] conversion from ‘<brace-enclosed
initializer list>’ to ‘F’ is ambiguous since
r10-6388-ge98ebda074bf8fc5
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: jason at gcc dot gnu.org
Target Milestone: ---
I found it in libqt5-qtlocation package:
$ cat circle.ii
template <int _Nm> struct A { typedef int _Type[_Nm]; };
template <int _Nm> struct B { typename A<_Nm>::_Type _M_elems; };
class C;
class D {
D(C);
};
class F {
public:
F(B<2>);
F(D);
};
F fn1() { return {{{0}}}; }
$ g++ -c circle.ii
circle.ii: In function ‘F fn1()’:
circle.ii:12:24: error: conversion from ‘<brace-enclosed initializer list>’ to
‘F’ is ambiguous
12 | F fn1() { return {{{0}}}; }
| ^
circle.ii:10:3: note: candidate: ‘F::F(D)’
10 | F(D);
| ^
circle.ii:9:3: note: candidate: ‘F::F(B<2>)’
9 | F(B<2>);
| ^
Note that clang is also happy about the code.