[libcxx-commits] [libcxx] [libc++][test] Avoid assert() in gnu/hash/specializations.verify.cpp (PR #237485)

Vitaly Buka via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 30 22:04:02 PDT 2026


https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/237485

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

>From a67dc85e60c6421aa889e713e992302deb59a2b4 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Fri, 30 Oct 2026 22:03:51 -0700
Subject: [PATCH] [spr] update

Created using spr 2.0.0-beta.2
---
 libcxx/test/extensions/gnu/hash/specializations.verify.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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;
 }



More information about the libcxx-commits mailing list