microsoft / microsoft/DirectXShaderCompiler
`column_major` and `row_major` don't apply correctly to template-dependent types
Open
Nobody has claimed this yet.
hlsl2021
matrix-bug
tech-debt
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
This is caused by the same issue as #4583, so the required transformation is similar.
This test case should cover the interesting cases:
// RUN: %clang_cc1 -HV 2021 -fsyntax-only -ffreestanding -verify %s
template <typename T, int X, int Y>
struct Matrices {
row_major matrix<T, X, Y> RowMajor;
column_major matrix<T, X, Y> RowMajor;
row_major T NotAMatrix; // expected-error {{'row_major' can only be used with a matrix type}}
column_major T AlsoNotAMatrix; // expected-error {{'column_major' can only be used with a matrix type}}
};
struct AlsoMatrices {
row_major matrix<float, 4, 4> RowMajor;
column_major matrix<float, 4, 4> RowMajor;
row_major float NotAMatrix; // expected-error {{'row_major' can only be used with a matrix type}}
column_major float AlsoNotAMatrix; // expected-error {{'column_major' can only be used with a matrix type}}
};
void fn() {
Matrices<float, 4, 4> ShouldWork;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the template-dependent matrix declarations in this issue with the required transformation described in #4583. Run the provided clang_cc1 test case with -HV 2021 and -verify; done means the matrix qualifiers work for dependent types while the non-matrix declarations produce the shown diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100