-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[clang] Implement CWG2398 provisional TTP matching to class templates #94981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2729c98
530f884
9c307db
c414b9c
653f6fa
09440f8
b9900e4
ae27685
2ace043
5275f0d
446f916
861d1bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11733,6 +11733,9 @@ class Sema final : public SemaBase { | |
/// receive true if the cause for the error is the associated constraints of | ||
/// the template not being satisfied by the template arguments. | ||
/// | ||
/// \param DefaultArgs any default arguments from template specialization | ||
/// deduction. | ||
/// | ||
/// \param PartialOrderingTTP If true, assume these template arguments are | ||
/// the injected template arguments for a template template parameter. | ||
/// This will relax the requirement that all its possible uses are valid: | ||
|
@@ -11742,7 +11745,8 @@ class Sema final : public SemaBase { | |
/// \returns true if an error occurred, false otherwise. | ||
bool CheckTemplateArgumentList( | ||
TemplateDecl *Template, SourceLocation TemplateLoc, | ||
TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, | ||
TemplateArgumentListInfo &TemplateArgs, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if instead we want to add an additional method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not seeing a worthwhile tradeoff. Just the function signature is hugely complicated, and would need to be duplicated. What did you have in mind? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bool CheckTemplateArgumentList(
TemplateDecl *Template, SourceLocation TemplateLoc,
TemplateArgumentListInfo &TemplateArgs,
bool PartialTemplateArgs,
SmallVectorImpl<TemplateArgument> &SugaredConverted,
SmallVectorImpl<TemplateArgument> &CanonicalConverted,
bool UpdateArgsWithConversions = true,
bool *ConstraintsNotSatisfied = nullptr, bool PartialOrderingTTP = false, const DefaultArguments * DefaultArgs = nullptr);
bool CheckTemplateArgumentList(
TemplateDecl *Template, SourceLocation TemplateLoc,
TemplateArgumentListInfo &TemplateArgs,
const DefaultArguments & DefaultArgs,
SmallVectorImpl<TemplateArgument> &SugaredConverted,
SmallVectorImpl<TemplateArgument> &CanonicalConverted) {
return CheckTemplateArgumentList(Template, TemplateLoc,
/*PartialTemplateArgs=*/false,
SugaredConverted, CanonicalConverted,
/*UpdateArgsWithConversions=*/true,
nullptr, false, &DefaultArgs);
} Maybe something like that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. One issue I have often had with these functions with large amount of both defaulted and non-defaulted parameters, is that you would want to extend it by changing the signature, then arguments would match parameters incorrectly, but this would not cause a hard error on all of the call sites. I could have easily added DefaultArgs as defaulted empty here, but chose not to due to this reason. Besides that, overloading functions with such huge numbers of parameters creates some confusion as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we think about ways to simplify these interface in a subsequent patch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's enough repeated stuff though these interfaces here, I don't think I'd mind a followup that created an object to contain all the related stuff. For example, the Sugared/Canonical vectors shoudl probably be a vectro of TempalteArgument pairs (or more likely their own structure) or something? But I'm open to other ideas as well (agian in a followup). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem with the separate Sugared / Converted lists I already have an incomplete patch to address that, though I am currently working on something else. |
||
const DefaultArguments &DefaultArgs, bool PartialTemplateArgs, | ||
SmallVectorImpl<TemplateArgument> &SugaredConverted, | ||
SmallVectorImpl<TemplateArgument> &CanonicalConverted, | ||
bool UpdateArgsWithConversions = true, | ||
|
@@ -12479,8 +12483,8 @@ class Sema final : public SemaBase { | |
sema::TemplateDeductionInfo &Info); | ||
|
||
bool isTemplateTemplateParameterAtLeastAsSpecializedAs( | ||
TemplateParameterList *PParam, TemplateDecl *AArg, SourceLocation Loc, | ||
bool IsDeduced); | ||
TemplateParameterList *PParam, TemplateDecl *AArg, | ||
const DefaultArguments &DefaultArgs, SourceLocation Loc, bool IsDeduced); | ||
|
||
/// Mark which template parameters are used in a given expression. | ||
/// | ||
|
Uh oh!
There was an error while loading. Please reload this page.