diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index 044cf5cf18d0a..da85959c005fe 100644 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -1105,10 +1105,6 @@ static bool CheckFunctionConstraintsWithoutInstantiation( } Sema::ContextRAII SavedContext(SemaRef, FD); - std::optional ThisScope; - if (auto *Method = dyn_cast(FD)) - ThisScope.emplace(SemaRef, /*Record=*/Method->getParent(), - /*ThisQuals=*/Method->getMethodQualifiers()); return SemaRef.CheckConstraintSatisfaction( Template, TemplateAC, MLTAL, PointOfInstantiation, Satisfaction); } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 698d1270be634..21fed2e8f6ca7 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -4749,8 +4749,6 @@ Sema::CheckConceptTemplateId(const CXXScopeSpec &SS, EnterExpressionEvaluationContext EECtx{ *this, ExpressionEvaluationContext::Unevaluated, CSD}; - ContextRAII CurContext(*this, CSD->getDeclContext(), - /*NewThisContext=*/false); if (!AreArgsDependent && CheckConstraintSatisfaction( NamedConcept, AssociatedConstraint(NamedConcept->getConstraintExpr()), diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp index 663bc984ece2e..d63ad01b35800 100644 --- a/clang/test/SemaTemplate/concepts.cpp +++ b/clang/test/SemaTemplate/concepts.cpp @@ -1228,26 +1228,26 @@ template struct KnownType { } -namespace GH115838 { +namespace CWG2369_Regression_2 { -template concept has_x = requires(T t) {{ t.x };}; - -class Publ { public: int x = 0; }; -class Priv { private: int x = 0; }; -class Prot { protected: int x = 0; }; -class Same { protected: int x = 0; }; - -template class D; -template requires ( has_x) class D: public T { public: static constexpr bool has = 1; }; -template requires (!has_x) class D: public T { public: static constexpr bool has = 0; }; +template +concept HasFastPropertyForAttribute = + requires(T element, int name) { element.propertyForAttribute(name); }; + +template +struct SVGPropertyOwnerRegistry { + static int fastAnimatedPropertyLookup() { + static_assert (HasFastPropertyForAttribute); + return 1; + } +}; -// "Same" is identical to "Prot" but queried before used. -static_assert(!has_x, "Protected should be invisible."); -static_assert(!D::has, "Protected should be invisible."); +class SVGCircleElement { + friend SVGPropertyOwnerRegistry; + void propertyForAttribute(int); +}; -static_assert( D::has, "Public should be visible."); -static_assert(!D::has, "Private should be invisible."); -static_assert(!D::has, "Protected should be invisible."); +int i = SVGPropertyOwnerRegistry::fastAnimatedPropertyLookup(); }