]> 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 445ede3d43baff9f1ced1f62a8e66f5619b0d6b9..57f80a55e85471cd05a2a5a6f8ba0e60a0783d61 100644 (file)
@@ -1,11 +1,11 @@
 // 2000-01-10 bkoz
 
-// Copyright (C) 2000, 2001, 2003, 2004 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
 // terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
+// Free Software Foundation; either version 3, or (at your option)
 // any later version.
 
 // This library is distributed in the hope that it will be useful,
 // GNU General Public License for more details.
 
 // You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
 
 // 27.7.2.2 member functions (istringstream_members)
 
 #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*
@@ -34,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);
@@ -52,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 );
 
@@ -60,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 );