nvcc does not diagnose overloading resolution diagnostics
if it happens in functions not emitted, e.g., if a device
function calls a host function, it is not diagnosed in
host compilation. clang implemented a similar feature
under option -fgpu-defer-diags.
Although clang is able to defer overloading resolution
diagnostics for common functions. It does not defer
overloading resolution caused diagnostics for overloaded
operators. For example, the diagnostics of this test
https://godbolt.org/z/P5eGrrnEd is deferred by nvcc
but not by clang.
This patch extends the existing deferred
diagnostic mechanism and defers a diagnostic caused
by overloaded operator.
If we're allowing to postpone an invalid call of a host function, shouldn't we also allow postponing other errors?
E.g. should we postpone the error on an attempt to call callee4() ?
Similarly, if we were to call a undeclared_func() here, should the error also be postponed?
TBH, I don't quite understand now how to tell what is and isn't supposed to be deferred with -fgpu-defer-diags.
Is there a clear criteria what should and should not be deferred?