Author: Erich Keane Date: 2023-09-19T08:31:18-07:00 New Revision: 11bb5e55dc1fa00f522ce73805d36e0b76819386
URL: https://github.com/llvm/llvm-project/commit/11bb5e55dc1fa00f522ce73805d36e0b76819386 DIFF: https://github.com/llvm/llvm-project/commit/11bb5e55dc1fa00f522ce73805d36e0b76819386.diff LOG: In ExprRequirement building, treat OverloadExpr as dependent (#66683) As reported in #66612, we aren't correctly treating the placeholder expression type correctly, so we ended up trying to get a reference version of it, and this resulted in an assertion, since the placeholder type cannot have a reference added. Fixes: #66612 Added: Modified: clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaExprCXX.cpp clang/test/SemaTemplate/concepts.cpp Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 30c29a5d6db6f5e..ba91f9481fe988a 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 <https://github.com/llvm/llvm-project/issues/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 bb4ef065d5c72aa..77289595972e3cf 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 891b45aa5789296..68050e0f09e248a 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<typename C> + auto end(C c) ->int; + + template <typename T> + concept Iterator = true; + + template <typename CT> + concept Container = requires(CT b) { + { end } -> Iterator; // #66612GH_END + }; + + static_assert(Container<int>);// 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?}} +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits