Skip to content

Propagate ParameterModifiers in templates#4089

Merged
llvm-beanz merged 1 commit intomicrosoft:masterfrom
llvm-beanz:cbieneman/4084-template-param-modifiers
Nov 18, 2021
Merged

Propagate ParameterModifiers in templates#4089
llvm-beanz merged 1 commit intomicrosoft:masterfrom
llvm-beanz:cbieneman/4084-template-param-modifiers

Conversation

@llvm-beanz
Copy link
Copy Markdown
Collaborator

This addresses two issues that blocked template instantiation of
functions with ParameterModifiers.

The first issue is that template deduction was not propagating
ParameterModifiers, but since the modifiers do influence overload
resolution, matches were never being found.

The second issue is that template instantiation was not propagating
ParameterModifiers, so even if dedution managed to succeed, it would
produce an instantiaton that wouldn't match.

The silly issue that still remains after this is that our
ParameterModifiers sholud be attached to the QualType for the
parameters. We already bake in the effect of the ParameterModifier to
the QualType, so we were getting overload mismatches on identical
functions. If we move the ParameterModifiers to the QualTypes similar
to other type qualifiers, we can actually get rid of this patch.

This resolves #4084

This addresses two issues that blocked template instantiation of
functions with ParameterModifiers.

The first issue is that template deduction was not propagating
ParameterModifiers, but since the modifiers do influence overload
resolution, matches were never being found.

The second issue is that template instantiation was not propagating
ParameterModifiers, so even if dedution managed to succeed, it would
produce an instantiaton that wouldn't match.

The silly issue that still remains after this is that our
ParameterModifiers sholud be attached to the QualType for the
parameters. We already bake in the effect of the ParameterModifier to
the QualType, so we were getting overload mismatches on identical
functions. If we move the ParameterModifiers to the QualTypes similar
to other type qualifiers, we can actually get rid of this patch.

This resolves microsoft#4084
@llvm-beanz llvm-beanz added the hlsl2021 Pertaining to HLSL2021 features label Nov 18, 2021
@llvm-beanz llvm-beanz requested review from pow2clk and tex3d November 18, 2021 17:12
Copy link
Copy Markdown
Contributor

@tex3d tex3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good, and your advice about moving the parameter modifiers sounds right. I guess we can do that in a future change, since it seems like a larger amount of work.

@llvm-beanz
Copy link
Copy Markdown
Collaborator Author

That was my thought. This is minimally invasive and should be good for the HLSL 2021 release.

@AppVeyorBot
Copy link
Copy Markdown

@llvm-beanz llvm-beanz merged commit 88c1779 into microsoft:master Nov 18, 2021
@llvm-beanz llvm-beanz deleted the cbieneman/4084-template-param-modifiers branch December 22, 2021 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hlsl2021 Pertaining to HLSL2021 features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Template partial specialization trips up around inout qualifier

3 participants