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
{{ message }}
Repository navigation
Impossible to add template on operator() overload #5194
I'm looking to add a template on an operator() overload, something like this:
struct Test {
template<typename T>
T operator()(const T x) {
return x;
}
};
[numthreads(32,1,1)]
void main() {
Test t;
t(5); // error
t<uint>(5); // error
t.operator()<uint>(5); // error
}
All syntax tests fail. Here is a link for testing: Link
Note that in C++ test(5) passes (the compiler infers the type) and t.operator()<uint>(5) passes as well.
This is caused by broken behavior in DXC's overload resolution. We have a bunch of related issues that will need to be addressed in order to support this planned fix for HLSL 202x.
That feature is effectively going to result in us adopting C++ overload rules completely for HLSL, which should solve this and related issues.
Activity
[-]Impossible to add template in operator() overload[/-][+]Impossible to add template on operator() overload[/+]llvm-beanz commentedon Jun 30, 2023
This is caused by broken behavior in DXC's overload resolution. We have a bunch of related issues that will need to be addressed in order to support this planned fix for HLSL 202x.
That feature is effectively going to result in us adopting C++ overload rules completely for HLSL, which should solve this and related issues.
devshgraphicsprogramming commentedon Aug 31, 2023
Chris B (@llvm-beanz) did you disable
operator=overloading too? its still in an example in the wiki