diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 30c29a5d6db6f..ba91f9481fe98 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -305,6 +305,9 @@ Bug Fixes to C++ Support that contains a `return`. (`#48527 `_) +- Clang now no longer asserts when an UnresolvedLookupExpr is used as an + expression requirement. (`#66612 https://github.com/llvm/llvm-project/issues/66612`) + Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ - Fixed an import failure of recursive friend class template. diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index bb4ef065d5c72..77289595972e3 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -9063,7 +9063,8 @@ Sema::BuildExprRequirement( concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement) { auto Status = concepts::ExprRequirement::SS_Satisfied; ConceptSpecializationExpr *SubstitutedConstraintExpr = nullptr; - if (E->isInstantiationDependent() || ReturnTypeRequirement.isDependent()) + if (E->isInstantiationDependent() || E->getType()->isPlaceholderType() || + ReturnTypeRequirement.isDependent()) Status = concepts::ExprRequirement::SS_Dependent; else if (NoexceptLoc.isValid() && canThrow(E) == CanThrowResult::CT_Can) Status = concepts::ExprRequirement::SS_NoexceptNotMet; diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp index 891b45aa57892..68050e0f09e24 100644 --- a/clang/test/SemaTemplate/concepts.cpp +++ b/clang/test/SemaTemplate/concepts.cpp @@ -1031,3 +1031,20 @@ void test() { fff(42UL); // expected-error {{no matching function}} } } + +namespace GH66612 { + template + auto end(C c) ->int; + + template + concept Iterator = true; + + template + concept Container = requires(CT b) { + { end } -> Iterator; // #66612GH_END + }; + + static_assert(Container);// expected-error{{static assertion failed}} + // expected-note@-1{{because 'int' does not satisfy 'Container'}} + // expected-note@#66612GH_END{{because 'end' would be invalid: reference to overloaded function could not be resolved; did you mean to call it?}} +}