tgjones / HlslTools

A Visual Studio extension that provides enhanced support for editing High Level Shading Language (HLSL) files
http://timjones.io/blog/archive/2016/04/25/hlsl-tools-for-visual-studio-v1.0-released
Other
561 stars 97 forks source link

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

Open hunterbridges opened 4 years ago

hunterbridges commented 4 years ago

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)