Issue 168737
Summary [Matrix][HLSL] Disallow Matrix as an HLSL Elementwise cast
Labels clang:frontend, HLSL
Assignees farzonl
Reporter farzonl
    > This case needs to be a part of the tests
> ```
> export int3x2 fn_helper(float2x3 f23) {
>     int3x2 i32 = (int3x2)f23;
>     return i32;
> }
> ```
> ```
> <source>:3:18: error: cannot convert from 'float2x3' to 'int3x2'
>     int3x2 i32 = (int3x2)f23;
> ```
> https://godbolt.org/z/anTMGGGc9 

 _Originally posted by @farzonl in [#162711](https://github.com/llvm/llvm-project/issues/162711#issuecomment-3549912958)_


`CanPerformElementwiseCast` in clang/lib/Sema/SemaHLSL.cpp defaults to true. Meaning right now we are erroneously makring all matrix casts as elementwise cast. Now that we have a new type in ConstantMantrix we need to check for this inside of `CanPerformElementwiseCast`.


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to