zequanwu added inline comments.
================ Comment at: clang/lib/Sema/SemaCast.cpp:897 + DiagnosticOptions::MSVC; + if (isMSVC || !DestPointee->isVoidType()) + Self.Diag(OpRange.getBegin(), ---------------- hans wrote: > I don't think the if-statement is necessary. I thought we concluded we want > to warn even for void*? Also note that "isMSVC" here is only checking the > driver mode, i.e. just the user interface to the compiler. The user could > still be compiling in MSVC mode. My bad. I thought you meant to use the previous version, so I reverted this region. Like we concluded, we want to warn even for void*. This only applies to clang-cl, not clang, right? This is the purpose of this if. If it's in clang-cl, warn regardless of destination type. If it's in clang, don't warn for void*, like line 887 which doesn't emit error for void* destination type. If RTTI is false, RTTIData is also false (https://github.com/llvm/llvm-project/blob/master/clang/lib/Frontend/CompilerInvocation.cpp#L2870). There is a test https://github.com/llvm/llvm-project/blob/master/clang/test/SemaCXX/no-rtti.cpp#L28, which should not be warned, right? ================ Comment at: clang/test/SemaCXX/ms_no_dynamic_cast.cpp:19 + auto d = dynamic_cast<D1 *>(b); // expected-warning{{dynamic_cast will not work since RTTI data is disabled by /GR-}} + (void)typeid(int); // expected-warning{{typeid will not work since RTTI data is disabled by /GR-}} +} ---------------- hans wrote: > Is the cast to void necessary? Same comment for the next file. Yes, to suppress the warning of unused expression. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86369/new/ https://reviews.llvm.org/D86369 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits