]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix unexpected compilation error in neg tests
authorFrançois Dumont <frs.dumont@gmail.com>
Wed, 31 Jul 2024 20:25:20 +0000 (22:25 +0200)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 31 Jul 2024 20:39:15 +0000 (22:39 +0200)
Fix a compilation error that is not expected by the tests preserving
the expected ones.

The 'test' variable declaration is missing since commit
a9260b7eb688df43a724e25421ba40f35a89fee9 that removed the test global
variable in testsuite files.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/map/operators/1_neg.cc (test01): Add test variable
declaration.
* testsuite/23_containers/set/operators/1_neg.cc (test01): Likewise.

libstdc++-v3/testsuite/23_containers/map/operators/1_neg.cc
libstdc++-v3/testsuite/23_containers/set/operators/1_neg.cc

index 1cb089306906c491936ea594e41f6b335ea97949..0eb1eee640b838e7a557051419da5e423b5831f3 100644 (file)
@@ -28,14 +28,13 @@ void test01()
 {
   std::map<unsigned int, int> mapByIndex;
   std::map<std::string, unsigned> mapByName;
-  
+
   mapByIndex.insert(std::pair<unsigned, int>(0, 1));
   mapByIndex.insert(std::pair<unsigned, int>(6, 5));
-  
+
   std::map<unsigned, int>::iterator itr(mapByIndex.begin());
 
   // NB: notice, it's not mapByIndex!!
-  test &= itr != mapByName.end(); // { dg-error "no" } 
-  test &= itr == mapByName.end(); // { dg-error "no" } 
+  bool __attribute__((unused)) test = itr != mapByName.end(); // { dg-error "no" }
+  test &= itr == mapByName.end(); // { dg-error "no" }
 }
-
index be90ba51cd4e844df7e89e2d1391de7c3060e55e..28d08f308e17b2263af4c74f822ea2a93e9dc1cf 100644 (file)
@@ -28,11 +28,10 @@ void test01()
 {
   std::set<unsigned int> setByIndex;
   std::set<std::string> setByName;
-  
+
   std::set<unsigned int>::iterator itr(setByIndex.begin());
-  
+
   // NB: it's not setByIndex!!
-  test &= itr != setByName.end(); // { dg-error "no" } 
-  test &= itr == setByName.end(); // { dg-error "no" } 
+  bool __attribute__((unused)) test = itr != setByName.end(); // { dg-error "no" }
+  test &= itr == setByName.end(); // { dg-error "no" }
 }
-