Author: Yuanfang Chen Date: 2022-10-18T17:30:47-07:00 New Revision: 13d6a57cbe2776c4873302c0cf04e27b77bd2862
URL: https://github.com/llvm/llvm-project/commit/13d6a57cbe2776c4873302c0cf04e27b77bd2862 DIFF: https://github.com/llvm/llvm-project/commit/13d6a57cbe2776c4873302c0cf04e27b77bd2862.diff LOG: [Clang] constraints partial ordering should work with deduction guide D128750 incorrectly skips constraints partial ordering for deduction guide. This patch reverts that part. Fixes https://github.com/llvm/llvm-project/issues/58456. Added: clang/test/SemaTemplate/deduction-guide-partial-ordering.cpp Modified: clang/lib/Sema/SemaTemplateDeduction.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 00b1cf1224e2..0572a663561c 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -5243,8 +5243,7 @@ FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( } } - if (!Context.getLangOpts().CPlusPlus20 || isa<CXXDeductionGuideDecl>(FD1) || - isa<CXXDeductionGuideDecl>(FD2)) + if (!Context.getLangOpts().CPlusPlus20) return nullptr; // Match GCC on not implementing [temp.func.order]p6.2.1. diff --git a/clang/test/SemaTemplate/deduction-guide-partial-ordering.cpp b/clang/test/SemaTemplate/deduction-guide-partial-ordering.cpp new file mode 100644 index 000000000000..4f57d07a850d --- /dev/null +++ b/clang/test/SemaTemplate/deduction-guide-partial-ordering.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -std=c++20 -verify %s +// expected-no-diagnostics + +namespace pr58456 { + template<typename> + struct s { + constexpr s(auto) { + } + }; + + template<typename T> + s(T) -> s<int>; + + template<typename T> requires true + s(T) -> s<int>; + + void f() { + auto const y = s(0); + } +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits