Issue 239809
Summary [HLSL] Should `sizeof` reject intangible types?
Labels HLSL
Assignees
Reporter hekota
    DXC rejects to calculate `sizeof` of a resource or a struct that contains a resource:

```
struct Material {
  float2 uvScale;
  float3 color;
 Texture2D<float4> Tex;
};

RWBuffer<uint> Out;

[numthreads(1,1,1)]
void main() {
    Out[0] = sizeof(Material); // errror
    Out[1] = sizeof(RWBuffer<uint>); // error
}
```
https://godbolt.org/z/v4oxEr1oa

```
<source>:11:14: error: invalid application of 'sizeof' to non-numeric type 'Material'
    Out[0] = sizeof(Material);
             ^
<source>:12:14: error: invalid application of 'sizeof' to non-numeric type 'RWBuffer<uint>'
    Out[1] = sizeof(RWBuffer<uint>);
````

Should Clang reject it as well?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to