[libcxx-commits] [libcxx] [libc++][test] Avoid assert() in gnu/hash/specializations.verify.cpp (PR #237485)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 30 22:04:42 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
In glibc 2.44 under C++26, `<assert.h>` expands variadic `assert(...)` with `__VA_ARGS__` twice, causing the compile-time call-operator error in this `-verify` test (updated in #<!-- -->145476) to fire twice on https://lab.llvm.org/staging/#/builders/sanitizer-aarch64-linux-bootstrap-msan. Drop `<assert.h>` and check the call expression directly.
Assisted-by: Gemini
---
Full diff: https://github.com/llvm/llvm-project/pull/237485.diff
1 Files Affected:
- (modified) libcxx/test/extensions/gnu/hash/specializations.verify.cpp (+1-2)
``````````diff
diff --git a/libcxx/test/extensions/gnu/hash/specializations.verify.cpp b/libcxx/test/extensions/gnu/hash/specializations.verify.cpp
index 5a74a52dd3956a..d344c5f14eed90 100644
--- a/libcxx/test/extensions/gnu/hash/specializations.verify.cpp
+++ b/libcxx/test/extensions/gnu/hash/specializations.verify.cpp
@@ -8,12 +8,11 @@
// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated
-#include <assert.h>
#include <ext/hash_map>
#include <string>
int main(int, char**) {
- assert(__gnu_cxx::hash<std::string>()(std::string()) == 0); // expected-error {{does not provide a call operator}}
+ (void)__gnu_cxx::hash<std::string>()(std::string()); // expected-error {{does not provide a call operator}}
return 0;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/237485
More information about the libcxx-commits
mailing list