From 6599eda6ef9993777fbdc1c3889b0b526437bd64 Mon Sep 17 00:00:00 2001
From: Matthias Maennich <matthias@maennich.net>
Date: Thu, 5 Oct 2017 12:03:14 +0200
Subject: [PATCH] testRobustEncoding: restore format flags for std::cout before
 exiting

---
 testEncoding.cxx | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testEncoding.cxx b/testEncoding.cxx
index 2c5ef46e..2742fe45 100644
--- a/testEncoding.cxx
+++ b/testEncoding.cxx
@@ -75,6 +75,10 @@ static int testRobustEncoding()
   // test that the conversion functions handle invalid
   // unicode correctly/gracefully
 
+  // we manipulate the format flags of stdout, remember
+  // the original state here to restore before return
+  std::ios::fmtflags const& flags = std::cout.flags();
+
   int ret = 0;
   char cstr[] = { (char)-1, 0 };
   // this conversion could fail
@@ -120,6 +124,7 @@ static int testRobustEncoding()
     ret++;
   }
 
+  std::cout.flags(flags);
   return ret;
 }
 
-- 
GitLab