https://github.com/dyung created 
https://github.com/llvm/llvm-project/pull/174377

Change #173236 changed the emitted error message which caused the test 
`clang/test/SemaCXX/typeid.cpp` to fail if tested with a compiler that defaults 
to C++20 because the error message has changed. This change updates the test to 
expect the correct error message depending on whether the compiler defaults to 
C++20 or earlier.

>From 13952669f2d4a0b8d3852980e2943565d3ee6330 Mon Sep 17 00:00:00 2001
From: Douglas Yung <[email protected]>
Date: Mon, 5 Jan 2026 09:56:41 +0000
Subject: [PATCH] Update test for C++20 defaulting compilers after #173236
 changed the expected diagnostic message.

---
 clang/test/SemaCXX/typeid.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/clang/test/SemaCXX/typeid.cpp b/clang/test/SemaCXX/typeid.cpp
index 26cad1c88f4d6..51a18e624c23d 100644
--- a/clang/test/SemaCXX/typeid.cpp
+++ b/clang/test/SemaCXX/typeid.cpp
@@ -2,7 +2,12 @@
 
 void f()
 {
-  (void)typeid(int); // expected-error {{you need to include <typeinfo> before 
using the 'typeid' operator}}
+  (void)typeid(int);
+#if __cplusplus >= 202002L
+   // expected-error@-2 {{you need to include <typeinfo> or import std before 
using the 'typeid' operator}}
+#else
+   // expected-error@-4 {{you need to include <typeinfo> before using the 
'typeid' operator}}
+#endif
 }
 
 namespace std {

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to