Skip to content

[HLSL] Constant buffer codegen crashes when cbuffer contains a class #132309

@hekota

Description

@hekota
class Foo {
  float x;
};

cbuffer cb {
    Foo foo;
}
RWBuffer<float> Buf : register(u0);

[numthreads(4,1,1)]
void main() {
      Buf[0] = foo.x;
}

https://godbolt.org/z/c1fYheWWb

The codegen crashes in clang::CodeGen::HLSLBufferLayoutBuilder::layoutField because the layout code is not handling classes, only structs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    HLSLHLSL Language Supportclang:codegenIR generation bugs: mangling, exceptions, etc.crashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions