llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: cor3ntin (cor3ntin) <details> <summary>Changes</summary> Found by #<!-- -->93667 --- Full diff: https://github.com/llvm/llvm-project/pull/93817.diff 3 Files Affected: - (modified) clang/docs/ReleaseNotes.rst (+2) - (modified) clang/lib/Sema/SemaOverload.cpp (+1-1) - (modified) clang/test/SemaTemplate/concepts.cpp (+22) ``````````diff diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 9dc93f53fe716..f0cdccfcc3c23 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -816,6 +816,8 @@ Bug Fixes to C++ Support - Fix incorrect merging of modules which contain using declarations which shadow other declarations. This could manifest as ODR checker false positives. Fixes (`#80252 <https://github.com/llvm/llvm-project/issues/80252>`_) +- Fix a regression introduced in Clang 18 causing incorrect overload resolution in the presence of functions only + differering by their constraints when only one of these function was variadic. Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 6c5e8afbcfb6e..6c4ce1022ae27 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -10367,7 +10367,7 @@ static bool sameFunctionParameterTypeLists(Sema &S, FunctionDecl *Fn1 = Cand1.Function; FunctionDecl *Fn2 = Cand2.Function; - if (Fn1->isVariadic() != Fn1->isVariadic()) + if (Fn1->isVariadic() != Fn2->isVariadic()) return false; if (!S.FunctionNonObjectParamTypesAreEqual( diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp index 787cc809e2535..a4b42cad79abd 100644 --- a/clang/test/SemaTemplate/concepts.cpp +++ b/clang/test/SemaTemplate/concepts.cpp @@ -1122,3 +1122,25 @@ template <typename d> concept f = c< d >; template <f> struct e; // expected-note {{}} template <f d> struct e<d>; // expected-error {{class template partial specialization is not more specialized than the primary template}} } + + +namespace constrained_variadic { +template <typename T = int> +struct S { + void f(); // expected-note {{candidate}} + void f(...) requires true; // expected-note {{candidate}} + + void g(...); // expected-note {{candidate}} + void g() requires true; // expected-note {{candidate}} + + consteval void h(...); + consteval void h(...) requires true {}; +}; + +int test() { + S{}.f(); // expected-error{{call to member function 'f' is ambiguous}} + S{}.g(); // expected-error{{call to member function 'g' is ambiguous}} + S{}.h(); +} + +} `````````` </details> https://github.com/llvm/llvm-project/pull/93817 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits