[clang] [Clang][Diagnostics] Mention 'import std' in typeid diagnostic (PR #173236)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 25 02:41:40 PST 2025


================
@@ -8428,6 +8428,8 @@ def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert fro
 def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
 
 // Other C++ expressions
+def err_need_header_or_std_before_typeid : Error<
+  "you need to include <typeinfo> or import std before using the 'typeid' operator">;
 def err_need_header_before_typeid : Error<
----------------
ChuanqiXu9 wrote:

You can use `%select` clause to avoid redundency. Search `%select` in the same file for examples.

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


More information about the cfe-commits mailing list