ritter-x2a wrote:

> If we are adding a special case for handling overloads, perhaps a better 
> approach would be to consider inferring the caller context from the 
> enveloping function declaration attributes, and allow overload resolution to 
> pick a device function instead. It would avoid the errors you're trying to 
> suppress, and it will arguably make things more consistent -- the function 
> declaration will have the same signature in both host and device compilations.


One problem I encountered when I looked into such a solution is that the 
host/device attribute(s) are not necessarily parsed at the time when the 
overload resolution in template arguments of the return type happens, because 
the `__attribute__((device))` can come after the return type specifier (cf. the 
`DeviceUserOverloadFunHostDepr2` function in the test case).
So far I haven't found an existing mechanism in clang to solve this without a 
bigger change that introduces some sort of backtracking. I'd be happy about 
pointers in that direction.

https://github.com/llvm/llvm-project/pull/93546
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to