LukasBanana/XShaderCompiler

Illegal l-value assignment to output parameter with different type

LukasBanana opened this issue · 1 comments

Xsc detects illegal r-value assignments to output parameters like this one:

void foo(inout int bar) {}
void main() {
    foo(1);
}

However, it does not detect illegal l-value assignments to output parameters with different types:

void foo(inout int bar) {}
void main() {
    float x = 0;
    foo(x);
}

This is silently translated into this:

void foo(inout int bar) {}
void main() {
    float x;
    foo(int(x)); // ERROR: 'int(x)' is not an l-value
}

Fixed with 9b65534.