This produces a compilation error in a gnulib testdir:

g++ -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -I. -I../../gltests -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. 
-I../../gltests/.. -I../gllib -I../../gltests/../gllib -Wall 
-DCONTINUE_AFTER_ASSERT -Wno-error -Wno-error -g -O2 -MT test-map-c++.o -MD -MP 
-MF $depbase.Tpo -c -o test-map-c++.o ../../gltests/test-map-c++.cc &&\
mv -f $depbase.Tpo $depbase.Po
../../gltests/test-map-c++.cc:30:1: error: redefinition of 'bool streq(const 
char*, const char*)'
   30 | streq (const char *str1, const char *str2)
      | ^~~~~
In file included from ../../gltests/test-map-c++.cc:23:
../gllib/string.h:1347:1: note: 'bool streq(const char*, const char*)' 
previously defined here
 1347 | streq (char const *__s1, char const *__s2)
      | ^~~~~
../../gltests/test-map-c++.cc:30:1: warning: 'bool streq(const char*, const 
char*)' defined but not used [-Wunused-function]
   30 | streq (const char *str1, const char *str2)
      | ^~~~~
make[4]: *** [Makefile:27604: test-map-c++.o] Error 1

This patch fixes it.


2025-09-19  Bruno Haible  <[email protected]>

        map-c++-tests: Fix compilation error (regression 2025-09-17).
        * tests/test-map-c++.cc (streq): Remove function.
        * modules/map-c++-tests (Depends-on): Add stringeq.

diff --git a/modules/map-c++-tests b/modules/map-c++-tests
index edfbf2823f..cccd20d46e 100644
--- a/modules/map-c++-tests
+++ b/modules/map-c++-tests
@@ -5,6 +5,7 @@ tests/macros.h
 Depends-on:
 ansi-c++-opt
 array-map
+stringeq
 
 configure.ac:
 
diff --git a/tests/test-map-c++.cc b/tests/test-map-c++.cc
index a314bbe710..fea10c0c46 100644
--- a/tests/test-map-c++.cc
+++ b/tests/test-map-c++.cc
@@ -26,12 +26,6 @@
 
 static const int integers[6] = { 0, 1, 2, 3, 4, 5 };
 
-static bool
-streq (const char *str1, const char *str2)
-{
-  return strcmp (str1, str2) == 0;
-}
-
 int
 main (int argc, char *argv[])
 {




Reply via email to