@@ -11650,6 +11650,33 @@ class Sema final : public SemaBase {
1165011650 CTAK_DeducedFromArrayBound
1165111651 };
1165211652
11653+ struct CheckTemplateArgumentInfo {
11654+ explicit CheckTemplateArgumentInfo(bool PartialOrdering = false,
11655+ bool MatchingTTP = false)
11656+ : PartialOrdering(PartialOrdering), MatchingTTP(MatchingTTP) {}
11657+ CheckTemplateArgumentInfo(const CheckTemplateArgumentInfo &) = delete;
11658+ CheckTemplateArgumentInfo &
11659+ operator=(const CheckTemplateArgumentInfo &) = delete;
11660+
11661+ /// The checked, converted argument will be added to the
11662+ /// end of these vectors.
11663+ SmallVector<TemplateArgument, 4> SugaredConverted, CanonicalConverted;
11664+
11665+ /// The check is being performed in the context of partial ordering.
11666+ bool PartialOrdering;
11667+
11668+ /// If true, assume these template arguments are
11669+ /// the injected template arguments for a template template parameter.
11670+ /// This will relax the requirement that all its possible uses are valid:
11671+ /// TTP checking is loose, and assumes that invalid uses will be diagnosed
11672+ /// during instantiation.
11673+ bool MatchingTTP;
11674+
11675+ /// Is set to true when, in the context of TTP matching, a pack parameter
11676+ /// matches non-pack arguments.
11677+ bool MatchedPackOnParmToNonPackOnArg;
11678+ };
11679+
1165311680 /// Check that the given template argument corresponds to the given
1165411681 /// template parameter.
1165511682 ///
@@ -11669,22 +11696,16 @@ class Sema final : public SemaBase {
1166911696 /// \param ArgumentPackIndex The index into the argument pack where this
1167011697 /// argument will be placed. Only valid if the parameter is a parameter pack.
1167111698 ///
11672- /// \param Converted The checked, converted argument will be added to the
11673- /// end of this small vector.
11674- ///
1167511699 /// \param CTAK Describes how we arrived at this particular template argument:
1167611700 /// explicitly written, deduced, etc.
1167711701 ///
1167811702 /// \returns true on error, false otherwise.
11679- bool
11680- CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg,
11681- NamedDecl *Template, SourceLocation TemplateLoc,
11682- SourceLocation RAngleLoc, unsigned ArgumentPackIndex,
11683- SmallVectorImpl<TemplateArgument> &SugaredConverted,
11684- SmallVectorImpl<TemplateArgument> &CanonicalConverted,
11685- CheckTemplateArgumentKind CTAK, bool PartialOrdering,
11686- bool PartialOrderingTTP,
11687- bool *MatchedPackOnParmToNonPackOnArg);
11703+ bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg,
11704+ NamedDecl *Template, SourceLocation TemplateLoc,
11705+ SourceLocation RAngleLoc,
11706+ unsigned ArgumentPackIndex,
11707+ CheckTemplateArgumentInfo &CTAI,
11708+ CheckTemplateArgumentKind CTAK);
1168811709
1168911710 /// Check that the given template arguments can be provided to
1169011711 /// the given template, converting the arguments along the way.
@@ -11717,22 +11738,15 @@ class Sema final : public SemaBase {
1171711738 /// \param DefaultArgs any default arguments from template specialization
1171811739 /// deduction.
1171911740 ///
11720- /// \param PartialOrderingTTP If true, assume these template arguments are
11721- /// the injected template arguments for a template template parameter.
11722- /// This will relax the requirement that all its possible uses are valid:
11723- /// TTP checking is loose, and assumes that invalid uses will be diagnosed
11724- /// during instantiation.
11725- ///
1172611741 /// \returns true if an error occurred, false otherwise.
11727- bool CheckTemplateArgumentList(
11728- TemplateDecl *Template, SourceLocation TemplateLoc,
11729- TemplateArgumentListInfo &TemplateArgs,
11730- const DefaultArguments &DefaultArgs, bool PartialTemplateArgs,
11731- SmallVectorImpl<TemplateArgument> &SugaredConverted,
11732- SmallVectorImpl<TemplateArgument> &CanonicalConverted,
11733- bool UpdateArgsWithConversions = true,
11734- bool *ConstraintsNotSatisfied = nullptr, bool PartialOrderingTTP = false,
11735- bool *MatchedPackOnParmToNonPackOnArg = nullptr);
11742+ bool CheckTemplateArgumentList(TemplateDecl *Template,
11743+ SourceLocation TemplateLoc,
11744+ TemplateArgumentListInfo &TemplateArgs,
11745+ const DefaultArguments &DefaultArgs,
11746+ bool PartialTemplateArgs,
11747+ CheckTemplateArgumentInfo &CTAI,
11748+ bool UpdateArgsWithConversions = true,
11749+ bool *ConstraintsNotSatisfied = nullptr);
1173611750
1173711751 bool CheckTemplateTypeArgument(
1173811752 TemplateTypeParmDecl *Param, TemplateArgumentLoc &Arg,
@@ -11757,7 +11771,7 @@ class Sema final : public SemaBase {
1175711771 QualType InstantiatedParamType, Expr *Arg,
1175811772 TemplateArgument &SugaredConverted,
1175911773 TemplateArgument &CanonicalConverted,
11760- bool PartialOrderingTTP ,
11774+ bool MatchingTTP ,
1176111775 CheckTemplateArgumentKind CTAK);
1176211776
1176311777 /// Check a template argument against its corresponding
0 commit comments