ecatmur updated this revision to Diff 414825. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121517/new/
https://reviews.llvm.org/D121517 Files: clang/lib/Sema/SemaTemplateDeduction.cpp clang/test/SemaCXX/overload-call.cpp Index: clang/test/SemaCXX/overload-call.cpp =================================================================== --- clang/test/SemaCXX/overload-call.cpp +++ clang/test/SemaCXX/overload-call.cpp @@ -688,3 +688,13 @@ f(pmf); } } + +namespace PR54347 { + template<class T> void f(T&, int); // expected-note {{candidate function}} + template<class U, class T> void f(T const&, U) // expected-note {{candidate function}}; + void g(int const& i) { f(i, 0); } // expected-error {{ambiguous}} + + template<class T> void f(T(&)[5], int); // expected-note {{candidate function}} + template<class U, class T> void f(T const(&)[5], U); // expected-note {{candidate function}} + void g(int const(& a)[5]) { f(a, 0); } // expected-error {{ambiguous}} +} Index: clang/lib/Sema/SemaTemplateDeduction.cpp =================================================================== --- clang/lib/Sema/SemaTemplateDeduction.cpp +++ clang/lib/Sema/SemaTemplateDeduction.cpp @@ -1358,7 +1358,7 @@ if (ARef) A = A->getPointeeType(); - if (PRef && ARef && S.Context.hasSameUnqualifiedType(P, A)) { + if (PRef && ARef) { // C++11 [temp.deduct.partial]p9: // If, for a given type, deduction succeeds in both directions (i.e., // the types are identical after the transformations above) and both
Index: clang/test/SemaCXX/overload-call.cpp =================================================================== --- clang/test/SemaCXX/overload-call.cpp +++ clang/test/SemaCXX/overload-call.cpp @@ -688,3 +688,13 @@ f(pmf); } } + +namespace PR54347 { + template<class T> void f(T&, int); // expected-note {{candidate function}} + template<class U, class T> void f(T const&, U) // expected-note {{candidate function}}; + void g(int const& i) { f(i, 0); } // expected-error {{ambiguous}} + + template<class T> void f(T(&)[5], int); // expected-note {{candidate function}} + template<class U, class T> void f(T const(&)[5], U); // expected-note {{candidate function}} + void g(int const(& a)[5]) { f(a, 0); } // expected-error {{ambiguous}} +} Index: clang/lib/Sema/SemaTemplateDeduction.cpp =================================================================== --- clang/lib/Sema/SemaTemplateDeduction.cpp +++ clang/lib/Sema/SemaTemplateDeduction.cpp @@ -1358,7 +1358,7 @@ if (ARef) A = A->getPointeeType(); - if (PRef && ARef && S.Context.hasSameUnqualifiedType(P, A)) { + if (PRef && ARef) { // C++11 [temp.deduct.partial]p9: // If, for a given type, deduction succeeds in both directions (i.e., // the types are identical after the transformations above) and both
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits