diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index 290e4cbff4fd6f..39169664dad552 100755 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -329,13 +329,6 @@ bool Sema::CheckFunctionConstraints(const FunctionDecl *FD, Satisfaction.IsSatisfied = true; return false; } - Qualifiers ThisQuals; - CXXRecordDecl *Record = nullptr; - if (auto *Method = dyn_cast(FD)) { - ThisQuals = Method->getMethodQualifiers(); - Record = const_cast(Method->getParent()); - } - CXXThisScopeRAII ThisScope(*this, Record, ThisQuals, Record != nullptr); // We substitute with empty arguments in order to rebuild the atomic // constraint in a constant-evaluated context. // FIXME: Should this be a dedicated TreeTransform? diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 7094462e74c9c8..0e1d5fa77c693a 100755 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -4271,13 +4271,7 @@ bool Sema::CheckInstantiatedFunctionTemplateConstraints( Scope, MLTAL)) return true; } - Qualifiers ThisQuals; - CXXRecordDecl *Record = nullptr; - if (auto *Method = dyn_cast(Decl)) { - ThisQuals = Method->getMethodQualifiers(); - Record = Method->getParent(); - } - CXXThisScopeRAII ThisScope(*this, Record, ThisQuals, Record != nullptr); + return CheckConstraintSatisfaction(Template, TemplateAC, TemplateArgs, PointOfInstantiation, Satisfaction); } diff --git a/clang/test/SemaTemplate/instantiate-requires-clause.cpp b/clang/test/SemaTemplate/instantiate-requires-clause.cpp index 2a42e2410fc390..8e9d5bffa9068d 100644 --- a/clang/test/SemaTemplate/instantiate-requires-clause.cpp +++ b/clang/test/SemaTemplate/instantiate-requires-clause.cpp @@ -57,13 +57,4 @@ struct S3 { static constexpr void f(Args...) { } }; -static_assert((S3::f(), true)); - -template -struct S4 { - template - void foo() requires (*this, true) { } - void goo() requires (*this, true) { } -}; - -static_assert((S4{}.foo(), S4{}.goo(), true)); +static_assert((S3::f(), true)); \ No newline at end of file