================ @@ -484,6 +484,88 @@ non-constexpr function, which is by default a host function. Users can override the inferred host and device attributes of default destructors by adding explicit host and device attributes to them. +Deferred Diagnostics +==================== + +In HIP (and CUDA), a ``__host__ __device__`` function can be called from both +host and device code. Certain operations are not allowed on the device (e.g., +calling a host-only function, using variable-length arrays, or throwing +exceptions). However, a ``__host__ __device__`` function containing such +operations is only ill-formed if it is actually called from device code. + +Clang handles this through *deferred diagnostics*: errors and warnings in +``__host__ __device__`` functions are recorded during parsing but not emitted +immediately. They are only emitted if the function turns out to be reachable +from code that must run on the device. ---------------- Artem-B wrote:
Agreed. constexpr if handling improvement is indeed a subject for a separate patch. https://github.com/llvm/llvm-project/pull/185926 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
