Hi,

 I needed some diagnostics to sort out a failure observed on one of our 
targets in 27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc in the 
libstdc++ test suite and defined the `TEST_NUMPUT_VERBOSE' macro referred 
there.  That resulted in a compilation error like below:

.../libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc:
 In function 'void test02()':
.../libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc:48:22:
 error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' 
and 'std::basic_ostringstream<wchar_t>::__string_type {aka 
std::basic_string<wchar_t>}')
   cout << "result: " << os.str() << endl;
                      ^

The reason is cout is a plain character stream and does not accept wide 
characters.  An obvious fix is below, verified to produce correct output.

 OK to apply?

2014-06-10  Maciej W. Rozycki  <ma...@codesourcery.com>

        libstdc++-v3/
        * testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc
        (test02) [TEST_NUMPUT_VERBOSE]: Use `wcout' rather than `cout'.

  Maciej

gcc-test-libstdcxx-4402.patch
Index: 
gcc-fsf-trunk-quilt/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc
===================================================================
--- 
gcc-fsf-trunk-quilt.orig/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc
    2014-05-16 15:58:07.177522688 +0100
+++ 
gcc-fsf-trunk-quilt/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc
 2014-05-19 04:49:29.168978165 +0100
@@ -42,8 +42,8 @@ test02()
   wchar_t largebuf[512];
   swprintf(largebuf, 512, L"%.*Le", prec, val);
 #ifdef TEST_NUMPUT_VERBOSE
-  cout << "expect: " << largebuf << endl;
-  cout << "result: " << os.str() << endl;
+  wcout << "expect: " << largebuf << endl;
+  wcout << "result: " << os.str() << endl;
 #endif
   VERIFY( os && os.str() == largebuf );
 
@@ -58,8 +58,8 @@ test02()
 
   swprintf(largebuf, 512, L"%.*f", 3, val2);
 #ifdef TEST_NUMPUT_VERBOSE
-  cout << "expect: " << largebuf << endl;
-  cout << "result: " << os2.str() << endl;
+  wcout << "expect: " << largebuf << endl;
+  wcout << "result: " << os2.str() << endl;
 #endif
   VERIFY( os2 && os2.str() == largebuf );
 }

Reply via email to