@@ -11751,7 +11751,8 @@ class Sema final : public SemaBase {
11751
11751
CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
11752
11752
const DeclarationNameInfo &ConceptNameInfo,
11753
11753
NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
11754
- const TemplateArgumentListInfo *TemplateArgs);
11754
+ const TemplateArgumentListInfo *TemplateArgs,
11755
+ bool DoCheckConstraintSatisfaction = true);
11755
11756
11756
11757
void diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc);
11757
11758
void diagnoseMissingTemplateArguments(const CXXScopeSpec &SS,
@@ -12833,6 +12834,9 @@ class Sema final : public SemaBase {
12833
12834
void MarkUsedTemplateParameters(ArrayRef<TemplateArgument> TemplateArgs,
12834
12835
unsigned Depth, llvm::SmallBitVector &Used);
12835
12836
12837
+ void MarkUsedTemplateParameters(ArrayRef<TemplateArgumentLoc> TemplateArgs,
12838
+ unsigned Depth, llvm::SmallBitVector &Used);
12839
+
12836
12840
void
12837
12841
MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate,
12838
12842
llvm::SmallBitVector &Deduced) {
@@ -13395,6 +13399,11 @@ class Sema final : public SemaBase {
13395
13399
const MultiLevelTemplateArgumentList &TemplateArgs,
13396
13400
TemplateArgumentListInfo &Outputs);
13397
13401
13402
+ bool SubstTemplateArgumentsInParameterMapping(
13403
+ ArrayRef<TemplateArgumentLoc> Args,
13404
+ const MultiLevelTemplateArgumentList &TemplateArgs,
13405
+ TemplateArgumentListInfo &Out);
13406
+
13398
13407
/// Retrieve the template argument list(s) that should be used to
13399
13408
/// instantiate the definition of the given declaration.
13400
13409
///
@@ -14744,6 +14753,10 @@ class Sema final : public SemaBase {
14744
14753
SatisfactionStack.swap(NewSS);
14745
14754
}
14746
14755
14756
+ using ConstrainedDeclOrNestedRequirement =
14757
+ llvm::PointerUnion<const NamedDecl *,
14758
+ const concepts::NestedRequirement *>;
14759
+
14747
14760
/// Check whether the given expression is a valid constraint expression.
14748
14761
/// A diagnostic is emitted if it is not, false is returned, and
14749
14762
/// PossibleNonPrimary will be set to true if the failure might be due to a
@@ -14768,44 +14781,11 @@ class Sema final : public SemaBase {
14768
14781
/// \returns true if an error occurred and satisfaction could not be checked,
14769
14782
/// false otherwise.
14770
14783
bool CheckConstraintSatisfaction(
14771
- const NamedDecl *Template ,
14784
+ ConstrainedDeclOrNestedRequirement Entity ,
14772
14785
ArrayRef<AssociatedConstraint> AssociatedConstraints,
14773
14786
const MultiLevelTemplateArgumentList &TemplateArgLists,
14774
- SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction) {
14775
- llvm::SmallVector<Expr *, 4> Converted;
14776
- return CheckConstraintSatisfaction(Template, AssociatedConstraints,
14777
- Converted, TemplateArgLists,
14778
- TemplateIDRange, Satisfaction);
14779
- }
14780
-
14781
- /// \brief Check whether the given list of constraint expressions are
14782
- /// satisfied (as if in a 'conjunction') given template arguments.
14783
- /// Additionally, takes an empty list of Expressions which is populated with
14784
- /// the instantiated versions of the ConstraintExprs.
14785
- /// \param Template the template-like entity that triggered the constraints
14786
- /// check (either a concept or a constrained entity).
14787
- /// \param ConstraintExprs a list of constraint expressions, treated as if
14788
- /// they were 'AND'ed together.
14789
- /// \param ConvertedConstraints a out parameter that will get populated with
14790
- /// the instantiated version of the ConstraintExprs if we successfully checked
14791
- /// satisfaction.
14792
- /// \param TemplateArgList the multi-level list of template arguments to
14793
- /// substitute into the constraint expression. This should be relative to the
14794
- /// top-level (hence multi-level), since we need to instantiate fully at the
14795
- /// time of checking.
14796
- /// \param TemplateIDRange The source range of the template id that
14797
- /// caused the constraints check.
14798
- /// \param Satisfaction if true is returned, will contain details of the
14799
- /// satisfaction, with enough information to diagnose an unsatisfied
14800
- /// expression.
14801
- /// \returns true if an error occurred and satisfaction could not be checked,
14802
- /// false otherwise.
14803
- bool CheckConstraintSatisfaction(
14804
- const NamedDecl *Template,
14805
- ArrayRef<AssociatedConstraint> AssociatedConstraints,
14806
- llvm::SmallVectorImpl<Expr *> &ConvertedConstraints,
14807
- const MultiLevelTemplateArgumentList &TemplateArgList,
14808
- SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction);
14787
+ SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction,
14788
+ const ConceptReference *TopLevelConceptId = nullptr);
14809
14789
14810
14790
/// \brief Check whether the given non-dependent constraint expression is
14811
14791
/// satisfied. Returns false and updates Satisfaction with the satisfaction
@@ -14871,16 +14851,16 @@ class Sema final : public SemaBase {
14871
14851
/// \param First whether this is the first time an unsatisfied constraint is
14872
14852
/// diagnosed for this error.
14873
14853
void DiagnoseUnsatisfiedConstraint(const ConstraintSatisfaction &Satisfaction,
14854
+ SourceLocation Loc = {},
14874
14855
bool First = true);
14875
14856
14876
14857
/// \brief Emit diagnostics explaining why a constraint expression was deemed
14877
14858
/// unsatisfied.
14878
- void
14879
- DiagnoseUnsatisfiedConstraint(const ASTConstraintSatisfaction &Satisfaction,
14880
- bool First = true);
14859
+ void DiagnoseUnsatisfiedConstraint(
14860
+ const ConceptSpecializationExpr *ConstraintExpr);
14881
14861
14882
14862
const NormalizedConstraint *getNormalizedAssociatedConstraints(
14883
- const NamedDecl *ConstrainedDecl ,
14863
+ ConstrainedDeclOrNestedRequirement Entity ,
14884
14864
ArrayRef<AssociatedConstraint> AssociatedConstraints);
14885
14865
14886
14866
/// \brief Check whether the given declaration's associated constraints are
@@ -14915,7 +14895,8 @@ class Sema final : public SemaBase {
14915
14895
/// constrained declarations). If an error occurred while normalizing the
14916
14896
/// associated constraints of the template or concept, nullptr will be cached
14917
14897
/// here.
14918
- llvm::DenseMap<const NamedDecl *, NormalizedConstraint *> NormalizationCache;
14898
+ llvm::DenseMap<ConstrainedDeclOrNestedRequirement, NormalizedConstraint *>
14899
+ NormalizationCache;
14919
14900
14920
14901
llvm::ContextualFoldingSet<ConstraintSatisfaction, const ASTContext &>
14921
14902
SatisfactionCache;
0 commit comments