https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24847

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Overload resolution considers both constructors, to decide which one v(i)
should use. Performing overload resolution on foo<int, 5, b>::foo(foo<int, 0,
b>) will cause the instantiation of struct foo<int, 0, b> to see if there is a
valid conversion sequence from int to foo<int, 0, b>. Instantiating that type
causes the instantiation of foo<int, 0, b>::foo(foo<int, 0, b>) which is indeed
an invalid copy constructor.

So the problem is not that it thinks the second constructor is a copy
constructor of foo<int, 5, b>, obviously it's not. But it is an invalid copy
constructor for foo<int, 0, b> which gets implicitly instantiated.

I don't know how Clang accepts this.

Reply via email to