tra added subscribers: jlebar, rsmith.
tra added a comment.

> This is different from nvcc behavior, where it is diagnosed only if the 
> function is really emitted:

That by itself is not a sufficient reason for relaxing the checks. Clang is 
stricter/more principled in diagnosing other questionalbe things nvcc lets 
through, even when it should not have. 
NVCC only sees part of the source, so it's limited in what it can diagnose 
during particular compilation side. Clang can do better.

> Current clang behavior causes diagnostics for wrong-sided reference emitted 
> twice, once in host compilation, once in device compilation, which is 
> unnecessary and cluttering the screen.

I don't think it's a problem. Clang will abort compilation if one of 
sub-compilation fails. We'll only see the error once.

> More importantly, current clang behavior causes false alarms for valid use 
> cases:

I'm not convinced that your example is valid. To me it looks like `test` should 
not have been a HD, given that it always uses a host function.

That said, I can see where it may be useful in case of `test` being a constexpr 
template function (for example somewhere in a standard library) parametrized by 
something else which may be host or device-only.
E.g. this may be a somewhat better example: https://godbolt.org/z/44vPv8

OK. I think it is useful, but I could also use a second opinion. 
@rsmith , @jlebar do you have any thoughts on this?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83893/new/

https://reviews.llvm.org/D83893



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to