@@ -11651,6 +11651,33 @@ class Sema final : public SemaBase {
11651
11651
CTAK_DeducedFromArrayBound
11652
11652
};
11653
11653
11654
+ struct CheckTemplateArgumentInfo {
11655
+ explicit CheckTemplateArgumentInfo(bool PartialOrdering = false,
11656
+ bool MatchingTTP = false)
11657
+ : PartialOrdering(PartialOrdering), MatchingTTP(MatchingTTP) {}
11658
+ CheckTemplateArgumentInfo(const CheckTemplateArgumentInfo &) = delete;
11659
+ CheckTemplateArgumentInfo &
11660
+ operator=(const CheckTemplateArgumentInfo &) = delete;
11661
+
11662
+ /// The checked, converted argument will be added to the
11663
+ /// end of these vectors.
11664
+ SmallVector<TemplateArgument, 4> SugaredConverted, CanonicalConverted;
11665
+
11666
+ /// The check is being performed in the context of partial ordering.
11667
+ bool PartialOrdering;
11668
+
11669
+ /// If true, assume these template arguments are
11670
+ /// the injected template arguments for a template template parameter.
11671
+ /// This will relax the requirement that all its possible uses are valid:
11672
+ /// TTP checking is loose, and assumes that invalid uses will be diagnosed
11673
+ /// during instantiation.
11674
+ bool MatchingTTP;
11675
+
11676
+ /// Is set to true when, in the context of TTP matching, a pack parameter
11677
+ /// matches non-pack arguments.
11678
+ bool MatchedPackOnParmToNonPackOnArg = false;
11679
+ };
11680
+
11654
11681
/// Check that the given template argument corresponds to the given
11655
11682
/// template parameter.
11656
11683
///
@@ -11670,22 +11697,16 @@ class Sema final : public SemaBase {
11670
11697
/// \param ArgumentPackIndex The index into the argument pack where this
11671
11698
/// argument will be placed. Only valid if the parameter is a parameter pack.
11672
11699
///
11673
- /// \param Converted The checked, converted argument will be added to the
11674
- /// end of this small vector.
11675
- ///
11676
11700
/// \param CTAK Describes how we arrived at this particular template argument:
11677
11701
/// explicitly written, deduced, etc.
11678
11702
///
11679
11703
/// \returns true on error, false otherwise.
11680
- bool
11681
- CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg,
11682
- NamedDecl *Template, SourceLocation TemplateLoc,
11683
- SourceLocation RAngleLoc, unsigned ArgumentPackIndex,
11684
- SmallVectorImpl<TemplateArgument> &SugaredConverted,
11685
- SmallVectorImpl<TemplateArgument> &CanonicalConverted,
11686
- CheckTemplateArgumentKind CTAK, bool PartialOrdering,
11687
- bool PartialOrderingTTP,
11688
- bool *MatchedPackOnParmToNonPackOnArg);
11704
+ bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg,
11705
+ NamedDecl *Template, SourceLocation TemplateLoc,
11706
+ SourceLocation RAngleLoc,
11707
+ unsigned ArgumentPackIndex,
11708
+ CheckTemplateArgumentInfo &CTAI,
11709
+ CheckTemplateArgumentKind CTAK);
11689
11710
11690
11711
/// Check that the given template arguments can be provided to
11691
11712
/// the given template, converting the arguments along the way.
@@ -11718,22 +11739,15 @@ class Sema final : public SemaBase {
11718
11739
/// \param DefaultArgs any default arguments from template specialization
11719
11740
/// deduction.
11720
11741
///
11721
- /// \param PartialOrderingTTP If true, assume these template arguments are
11722
- /// the injected template arguments for a template template parameter.
11723
- /// This will relax the requirement that all its possible uses are valid:
11724
- /// TTP checking is loose, and assumes that invalid uses will be diagnosed
11725
- /// during instantiation.
11726
- ///
11727
11742
/// \returns true if an error occurred, false otherwise.
11728
- bool CheckTemplateArgumentList(
11729
- TemplateDecl *Template, SourceLocation TemplateLoc,
11730
- TemplateArgumentListInfo &TemplateArgs,
11731
- const DefaultArguments &DefaultArgs, bool PartialTemplateArgs,
11732
- SmallVectorImpl<TemplateArgument> &SugaredConverted,
11733
- SmallVectorImpl<TemplateArgument> &CanonicalConverted,
11734
- bool UpdateArgsWithConversions = true,
11735
- bool *ConstraintsNotSatisfied = nullptr, bool PartialOrderingTTP = false,
11736
- bool *MatchedPackOnParmToNonPackOnArg = nullptr);
11743
+ bool CheckTemplateArgumentList(TemplateDecl *Template,
11744
+ SourceLocation TemplateLoc,
11745
+ TemplateArgumentListInfo &TemplateArgs,
11746
+ const DefaultArguments &DefaultArgs,
11747
+ bool PartialTemplateArgs,
11748
+ CheckTemplateArgumentInfo &CTAI,
11749
+ bool UpdateArgsWithConversions = true,
11750
+ bool *ConstraintsNotSatisfied = nullptr);
11737
11751
11738
11752
bool CheckTemplateTypeArgument(
11739
11753
TemplateTypeParmDecl *Param, TemplateArgumentLoc &Arg,
@@ -11758,7 +11772,7 @@ class Sema final : public SemaBase {
11758
11772
QualType InstantiatedParamType, Expr *Arg,
11759
11773
TemplateArgument &SugaredConverted,
11760
11774
TemplateArgument &CanonicalConverted,
11761
- bool PartialOrderingTTP ,
11775
+ bool MatchingTTP ,
11762
11776
CheckTemplateArgumentKind CTAK);
11763
11777
11764
11778
/// Check a template argument against its corresponding
0 commit comments