[clang] Update test for C++20 defaulting compilers after #173236 changed the expected diagnostic message. (PR #174377)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 5 02:01:26 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (dyung)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/174377.diff
1 Files Affected:
- (modified) clang/test/SemaCXX/typeid.cpp (+6-1)
``````````diff
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 at -2 {{you need to include <typeinfo> or import std before using the 'typeid' operator}}
+#else
+ // expected-error at -4 {{you need to include <typeinfo> before using the 'typeid' operator}}
+#endif
}
namespace std {
``````````
</details>
https://github.com/llvm/llvm-project/pull/174377
More information about the cfe-commits
mailing list