You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
HLSL interface declarations are very limited and a bit broken in DXC. Some examples are:
Given these declarations (which compile fine in isolation):
interface Animal {
voidWalk();
};
class Dog : Animal {
int4 Legs;
voidWalk() {}
};
class Worm : Animal {
voidcrawl() {}
};
The following errors can occur with subsequent expressions.
Function parameters cannot be declared of interface type. This is true for all parameter modifier specifications (in/inout/out).
Code:
voidmove(Animal A) {}
Diagnostics:
error: parameter type 'Animal' is an abstract class
void move(Animal A) {}
^
<source>:3:10: note: unimplemented pure virtual method 'Walk' in 'Animal'
void Walk();
^
Code:
Animal A;
Diagnostics:
<source>:20:10: error: variable type 'Animal' is an abstract class
Animal A;
^
This is the one case that seems to do somewhat what you would expect, except it only occurs on a declaration not at any other point.
Code:
Worm B;
Diagnostics
<source>:21:8: error: variable type 'Worm' is an abstract class
Worm B;
^
<source>:3:10: note: unimplemented pure virtual method 'Walk' in 'Worm'
void Walk();
^
Describe the solution you'd like
Interfaces are a bit of legacy that don't really work in HLSL. The functionality of interfaces can be provided with C++ templates using SFINAE or C++20 concepts. As we align the language in that direction we should remove the interface keyword in HLSL 202x.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
HLSL
interface
declarations are very limited and a bit broken in DXC. Some examples are:Given these declarations (which compile fine in isolation):
Compiler Explorer
The following errors can occur with subsequent expressions.
Function parameters cannot be declared of interface type. This is true for all parameter modifier specifications (in/inout/out).
Code:
Diagnostics:
Code:
Diagnostics:
This is the one case that seems to do somewhat what you would expect, except it only occurs on a declaration not at any other point.
Code:
Diagnostics
Describe the solution you'd like
Interfaces are a bit of legacy that don't really work in HLSL. The functionality of interfaces can be provided with C++ templates using SFINAE or C++20 concepts. As we align the language in that direction we should remove the
interface
keyword in HLSL 202x.The text was updated successfully, but these errors were encountered: