Skip to content
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

[HLSL] Template parameter elision creates confusing Diagnostics for mismatched vector (matrix) templates #112410

Open
pow2clk opened this issue Oct 15, 2024 · 0 comments
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer HLSL HLSL Language Support

Comments

@pow2clk
Copy link
Contributor

pow2clk commented Oct 15, 2024

Because HLSL vector types (and soon matrices) are defined as templates, some of the diagnostics will treat them as user-defined templates that don't match in all the particulars instead of printing them as types in their diagnostic messages.

These take the form of eliding the template elements that match, which makes it unclear what HLSL types they refer to or even that they refer to HLSL types. Two examples:

cannot initialize a variable of type 'vector<[...], 4>' with an lvalue of type 'vector<[...], 3>'
assigning to 'matrix<float, [2 * ...]>' from incompatible type 'matrix<int, [2 * ...]>

This can be seen in this test and will manifest in several of the new matrix tests.

The elision could be removed, but that would change behavior elsewhere. Perhaps a preferrable solution would be to direct these diagnostic prints to places where the types get printed instead of the more generic template outputs. These don't involve TypePrinter at all, rather the output comes from the TemplateDiff class in ASTDiagnostics.c

void PrintElideArgs(unsigned NumElideArgs, unsigned Indent) {

@pow2clk pow2clk added clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer HLSL HLSL Language Support labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer HLSL HLSL Language Support
Projects
Status: No status
Development

No branches or pull requests

1 participant