https://github.com/llvm-beanz commented:
I have a few small comments, but mostly I think this just needs a lot more
testing.
All your tests are doing explicit conversions, but the code is adding support
for _implicit_ conversions as well as explicit conversions. You're also adding
support for function overload resolution, but not testing any overload
resolution for matrix types.
Consider some of these cases:
```
void fn3x2(float3x2) {}
void fn2x2(float2x2) {}
void fn2x2IO(inout float2x2) {}
void fnI2x2IO(inout int2x2) {}
void matOrVec(float4 F) {}
void matOrVec(float2x2 F) {}
void matOrVec2(float3 F) {}
void matOrVec2(float2x3 F) {}
export void cases(float2x3 f23, float4x4 f44, float3x3 f33, float3x2 f32) {
int2x2 i22 = f23; // Allowed!
#ifdef ERROR
int3x2 i32 = f23; // Error!
fn3x2(f23); // Error!
#endif
fn2x2(f23); // Allowed!
#ifdef ERROR
// DXC disallows these, and I'm really unsure why...
fn2x2IO(f23); // Maybe allowed?
fnI2x2IO(f23); // Maybe allowed?
#endif
matOrVec(f23); // calls matOrVec(float2x2);
matOrVec(f44); // calls matOrVec(float2x2);
#ifdef ERROR
matOrVec(2.0); // Ambiguous!
matOrVec2(f23); // No viable conversion!
#endif
matOrVec2(f44); // calls matOrVec(float2x3);
matOrVec2(f33); // calls matOrVec(float2x3);
#ifdef ERROR
// I think the current language in the spec is wrong about this one!
matOrVec2(f32); // No known conversion from matrix to vector!
#endif
}
```
[Compiler Explorer](https://godbolt.org/z/WqYz5vEM3)
https://github.com/llvm/llvm-project/pull/168915
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits