Skip to content

Unexpected inout implicit type conversion #5951

@Nielsbishere

Description

@Nielsbishere

Description
Inout allows implicit casts such as float to uint. This is unexpected behavior and might end up causing a confusing debugging session.

Steps to Reproduce

struct PSInput {
    float4 color : COLOR;
};

void fun(inout uint v) {
    v = 1;
}

float4 PSMain(PSInput input) : SV_TARGET {
    float v = 2;
    fun(v);
    return input.color * v;
}

Actual Behavior
This should cause an error because a float should not be implicitly converted to a uint like this. For example if this was a uint& in C++ it would complain too.

Environment

  • DXC version: trunk on 2023-06-16+ (shader-playground) and up.
  • Host Operating System: N/A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashneeds-triageAwaiting triage

    Type

    No type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions