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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Luke Dalessandro from comment #2)
> Is this demonstrating the same behavior, and is clang wrong to accept?
> 
> ```
> template <class T, int = 1>
> struct Foo
> {
>     Foo() = default;
>     Foo(Foo const&) = delete;
> 
>     template <int I>
>     Foo(Foo<T, I> const&) {}
> };
> 
> template <class T, int I>
> Foo(Foo<T,I>) -> Foo<T,I+1>;
> 
> Foo<int> a;
> Foo b = a;
> ```
> 
> https://godbolt.org/z/njqPEKMM1

It seems clang is correct to accept, since a user defined deduction guide is
preferred over an equally specialized copy deduction candidate according to
[over.match.best].  I think this is instead a symptom of the recently fixed
PR86439; GCC trunk accepts this testcase after r12-1744.

Before closing this PR, we ought to add these two testcases to the testsuite.

Reply via email to