]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_ostringstream / rdbuf / char / 2832.cc
index fb0ca02ed9c630b069ce907b24420fb897f0f084..0a51fb63675acf13f6123096619c8200a847dc9e 100644 (file)
@@ -1,6 +1,6 @@
 // 2001-05-23 Benjamin Kosnik  <bkoz@redhat.com>
 
-// Copyright (C) 2001-2020 Free Software Foundation, Inc.
+// Copyright (C) 2001-2024 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -22,8 +22,8 @@
 #include <sstream>
 #include <testsuite_hooks.h>
 
-void 
-redirect_buffer(std::ios& stream, std::streambuf* new_buf) 
+void
+redirect_buffer(std::ios& stream, std::streambuf* new_buf)
 { stream.rdbuf(new_buf); }
 
 std::streambuf*
@@ -50,7 +50,7 @@ void test02()
   redirect_buffer(sstrm1, &sbuf);
   std::stringbuf* const buf2 = sstrm1.rdbuf();
   std::streambuf* pbasebuf2 = active_buffer(sstrm1);
-  VERIFY( buf1 == buf2 ); 
+  VERIFY( buf1 == buf2 );
   VERIFY( pbasebuf1 != pbasebuf2 );
   VERIFY( pbasebuf2 == pbasebuf0 );
 
@@ -58,7 +58,11 @@ void test02()
   VERIFY( sstrm1.str() != str01 );
   VERIFY( sstrm1.str() == str00 );
   // however, casting the active streambuf to a stringbuf shows what's up:
+#if __cpp_rtti
   std::stringbuf* psbuf = dynamic_cast<std::stringbuf*>(pbasebuf2);
+#else
+  std::stringbuf* psbuf = static_cast<std::stringbuf*>(pbasebuf2);
+#endif
   str02 = psbuf->str();
   VERIFY( str02 == str01 );