slang
slang copied to clipboard
Properly handle the mismatching "mutating" signature for implementing interfaces
Problem description
When the interface declares a function with [mutating]
, the implementation also has to have [mutating]
.
If the implementation didn't have the keyword, Slang crashes with an internal error.
Goal
We should print a proper error for the mistake.
Or it should work even when the implementation didn't have the matching [mutating]
keyword.
Repro steps The following code can reproduce the issue.
//TEST:SIMPLE:
//TEST:SIMPLE:-DWITH_MUTATING
interface IHitInfo
{
};
interface IClosestHitQuery
{
[mutating] void traceRay(out IHitInfo hit);
};
struct GeneratePathClosestHitQuery : IClosestHitQuery
{
#if defined(WITH_MUTATING)
[mutating]
#endif
void traceRay(out IHitInfo hit)
{
hit = {};
}
};
Note that the modifier out
is required to reproduce the issue.