]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/27_io/basic_istringstream/rdbuf/char/2832.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_istringstream / rdbuf / char / 2832.cc
index 985f17d119506775bb19a008f66f2c46b4073a0b..57f80a55e85471cd05a2a5a6f8ba0e60a0783d61 100644 (file)
@@ -1,6 +1,6 @@
 // 2000-01-10 bkoz
 
-// Copyright (C) 2000-2015 Free Software Foundation, Inc.
+// Copyright (C) 2000-2023 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*
@@ -33,7 +33,6 @@ active_buffer(std::ios& stream)
 // libstdc++/2832
 void test02()
 {
-  bool test __attribute__((unused)) = true;
   const char* strlit01 = "fuck war";
   const std::string str00;
   const std::string str01(strlit01);
@@ -51,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 );
 
@@ -59,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 );