Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions clang/lib/Sema/SemaConcept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,10 +1105,6 @@ static bool CheckFunctionConstraintsWithoutInstantiation(
}

Sema::ContextRAII SavedContext(SemaRef, FD);
std::optional<Sema::CXXThisScopeRAII> ThisScope;
if (auto *Method = dyn_cast<CXXMethodDecl>(FD))
ThisScope.emplace(SemaRef, /*Record=*/Method->getParent(),
/*ThisQuals=*/Method->getMethodQualifiers());
return SemaRef.CheckConstraintSatisfaction(
Template, TemplateAC, MLTAL, PointOfInstantiation, Satisfaction);
}
Expand Down
2 changes: 0 additions & 2 deletions clang/lib/Sema/SemaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
34 changes: 17 additions & 17 deletions clang/test/SemaTemplate/concepts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1228,26 +1228,26 @@ template <KnownKind T> struct KnownType {

}

namespace GH115838 {
namespace CWG2369_Regression_2 {

template<typename T> 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<typename T> class D;
template<typename T> requires ( has_x<T>) class D<T>: public T { public: static constexpr bool has = 1; };
template<typename T> requires (!has_x<T>) class D<T>: public T { public: static constexpr bool has = 0; };
template <typename T>
concept HasFastPropertyForAttribute =
requires(T element, int name) { element.propertyForAttribute(name); };

template <typename OwnerType>
struct SVGPropertyOwnerRegistry {
static int fastAnimatedPropertyLookup() {
static_assert (HasFastPropertyForAttribute<OwnerType>);
return 1;
}
};

// "Same" is identical to "Prot" but queried before used.
static_assert(!has_x<Same>, "Protected should be invisible.");
static_assert(!D<Same>::has, "Protected should be invisible.");
class SVGCircleElement {
friend SVGPropertyOwnerRegistry<SVGCircleElement>;
void propertyForAttribute(int);
};

static_assert( D<Publ>::has, "Public should be visible.");
static_assert(!D<Priv>::has, "Private should be invisible.");
static_assert(!D<Prot>::has, "Protected should be invisible.");
int i = SVGPropertyOwnerRegistry<SVGCircleElement>::fastAnimatedPropertyLookup();

}

Expand Down