Skip to content

Improve error reporting for intrinsic methods with type mismatched arguments #3055

Description

@pow2clk

In the course of writing tests for the fix to #2693 and #818, I discovered that intrinsic methods have their own error reporting path that fix doesn't resolve.

https://godbolt.org/z/ExYrj31z9

Texture2D<float4> tex;
SamplerComparisonState samp;

float4 main(float2 coord : C) : SV_Target {
  return tex.Sample(samp, coord);
}

The reporting attempts to report why both variants don't match, but the reporting for the arg type mismatch is elided due to incomplete error reporting from the HLSL code, so the only error message is for the second version, which takes more arguments, leading to this baffling error:

<source>:5:14: error: no matching member function for call to 'Sample'
  return tex.Sample(samp, coord);
         ~~~~^~~~~~
<source>:5:14: note: candidate function template not viable: requires 3 arguments, but 2 were provided
<source>:5:14: note: candidate function template not viable: requires 4 arguments, but 2 were provided
<source>:5:14: note: candidate function template not viable: requires 5 arguments, but 2 were provided

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions