[HLSL] Update support for user-defined operators to match DXC
Open
HLSL
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Update support for user-defined operators to match DXC. This includes custom operators on structs or classes, or global-scope operators. In general, any operator except assignments should be allowed. Custom assignment operators should report error.
```
struct P {
int p;
float operator=(float f) {
p = (int)f;
}
bool operator<=(float f) {
return p <= (int)f;
}
float operator+=(float f) {
return p += (int)f;
}
};
float operator=(int i) {
return (float)i;
}
```
https://godbolt.org/
Contributor guide
Assessment
This issue has not been assessed yet.