// RUN: %clang_cc1 -std=c++1z -verify %s template using Fn = T () noexcept(B); // - If the original A is a function pointer type, A can be "pointer to // function" even if the deduced A is "pointer to noexcept function". struct A { template operator Fn*(); // expected-note {{candidate}} }; struct B { template operator Fn*(); }; void (*p1)() = A(); void (*p2)() = B(); void (*p3)() noexcept = A(); // expected-error {{no viable conversion}} void (*p4)() noexcept = B(); // - If the original A is a pointer to member function type, A can be "pointer // to member of type function" even if the deduced A is "pointer to member of // type noexcept function". struct C { template operator Fn A::*(); // expected-note {{candidate}} }; struct D { template operator Fn A::*(); }; void (A::*q1)() = C(); void (A::*q2)() = D(); void (A::*q3)() noexcept = C(); // expected-error {{no viable conversion}} void (A::*q4)() noexcept = D(); // There is no corresponding rule for references. // FIXME: This seems like a defect. // FIXME: We don't actually implement the final check for equal types at all! // Instead, we handle the matching via [over.ics.user]p3: // "If the user-defined conversion is specified by a specialization of a // conversion function template, the second standard conversion sequence // shall have exact match rank." // Note that this *does* allow discarding noexcept, since that conversion has // Exact Match rank. struct E { template operator Fn&(); // expected-note {{candidate}} }; struct F { template operator Fn&(); }; void (&r1)() = E(); void (&r2)() = F(); void (&r3)() noexcept = E(); // expected-error {{no viable conversion}} void (&r4)() noexcept = F(); // FIXME: We reject this for entirely the wrong reason. We incorrectly succeed // in deducing T = void, U = G::B, and only fail due to [over.ics.user]p3. struct G { template struct A {}; template struct A : A {}; struct B { typedef int type; }; template operator A *(); // expected-note {{candidate function [with T = void, U = G::B]}} }; G::A *g = G(); // expected-error {{no viable conversion}}