Issue |
153055
|
Summary |
[HLSL] No matching constructor for struct initialization from a constant buffer struct
|
Labels |
bug,
HLSL
|
Assignees |
|
Reporter |
Icohedron
|
There is no matching constructor when initializing a local variable struct with a struct read from a constant buffer.
https://godbolt.org/z/e1n1xnj6r
```hlsl
// compile args: -T cs_6_7 -E CSMain -enable-16bit-types
RWStructuredBuffer<uint> output : register(u0);
struct MyStruct {
int i;
};
cbuffer MyBuffer : register(b0) {
MyStruct myS;
};
[numthreads(1, 1, 1)]
void CSMain() {
MyStruct s = myS;
output[0] = s.i;
}
```
```
<source>:10:12: error: no matching constructor for initialization of 'MyStruct'
10 | MyStruct s = myS;
| ^ ~~~
<source>:2:8: note: candidate constructor (the implicit copy constructor) not viable: cannot bind reference in address space 'hlsl_constant' to object in generic address space in 1st argument
2 | struct MyStruct {
| ^~~~~~~~
<source>:2:8: note: candidate constructor (the implicit move constructor) not viable: cannot bind reference in address space 'hlsl_constant' to object in generic address space in 1st argument
2 | struct MyStruct {
| ^~~~~~~~
<source>:2:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
1 error generated.
Compiler returned: 1
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs