[clang] [Sema][CUDA][HIP] Reject RTTI operations in device code (PR #228469)

Steffen Larsen via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 14 03:00:42 PDT 2026


================
@@ -987,6 +988,12 @@ void CastOperation::CheckDynamicCast() {
     return;
   }
 
+  // Similarly, dynamic_cast is not available in CUDA device code, except for
+  // dynamic_cast to void*.
+  if (Self.getLangOpts().CUDA && !DestPointee->isVoidType())
----------------
steffenlarsen wrote:

Sounds like we are in agreement. clang/test/CodeGenCUDA/device-dynamic-cast-void.cu should test the void* dynamic cast.

https://github.com/llvm/llvm-project/pull/228469


More information about the cfe-commits mailing list