HlslTools icon indicating copy to clipboard operation
HlslTools copied to clipboard

Live Error throws false positive HLSL0039 on converting inhereted struct to base type

Open hunterbridges opened this issue 5 years ago • 0 comments

Repro: Declare a struct type Foo, then another struct type Bar which inherits from it. Create an instance of Bar and attempt to cast it to Foo.

struct Foo
{
	int testy;
};

struct Bar : Foo
{
	int testo;
};

Output Main(Input input)
{
	Bar thingy = (Bar)0;
        (Foo)thingy;
	...
}

Expected: thingy is successfully casted to Foo and throws no error Actual: Live Error throws Cannot convert type 'Bar' to 'Foo'.Shader Tools(HLSL0039)

hunterbridges avatar Mar 19 '20 17:03 hunterbridges