libstdc++: Only use dynamic_cast in tests when RTTI is enabled
libstdc++-v3/ChangeLog: * testsuite/27_io/basic_istringstream/rdbuf/char/2832.cc: Use static_cast when RTTI is disabled. * testsuite/27_io/basic_istringstream/rdbuf/wchar_t/2832.cc: Likewise. * testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc: Likewise. * testsuite/27_io/basic_ostringstream/rdbuf/wchar_t/2832.cc: Likewise. * testsuite/27_io/basic_stringstream/str/char/2.cc: Likewise. * testsuite/27_io/basic_stringstream/str/wchar_t/2.cc: Likewise.
This commit is contained in:
parent
14b554c462
commit
e9c3105211
@ -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 );
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <sstream>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
redirect_buffer(std::wios& stream, std::wstreambuf* new_buf)
|
||||
void
|
||||
redirect_buffer(std::wios& stream, std::wstreambuf* new_buf)
|
||||
{ stream.rdbuf(new_buf); }
|
||||
|
||||
std::wstreambuf*
|
||||
@ -48,7 +48,7 @@ void test02()
|
||||
redirect_buffer(sstrm1, &sbuf);
|
||||
std::wstringbuf* const buf2 = sstrm1.rdbuf();
|
||||
std::wstreambuf* pbasebuf2 = active_buffer(sstrm1);
|
||||
VERIFY( buf1 == buf2 );
|
||||
VERIFY( buf1 == buf2 );
|
||||
VERIFY( pbasebuf1 != pbasebuf2 );
|
||||
VERIFY( pbasebuf2 == pbasebuf0 );
|
||||
|
||||
@ -56,7 +56,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::wstringbuf* psbuf = dynamic_cast<std::wstringbuf*>(pbasebuf2);
|
||||
#else
|
||||
std::wstringbuf* psbuf = static_cast<std::wstringbuf*>(pbasebuf2);
|
||||
#endif
|
||||
str02 = psbuf->str();
|
||||
VERIFY( str02 == str01 );
|
||||
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <sstream>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
redirect_buffer(std::wios& stream, std::wstreambuf* new_buf)
|
||||
void
|
||||
redirect_buffer(std::wios& stream, std::wstreambuf* new_buf)
|
||||
{ stream.rdbuf(new_buf); }
|
||||
|
||||
std::wstreambuf*
|
||||
@ -48,7 +48,7 @@ void test02()
|
||||
redirect_buffer(sstrm1, &sbuf);
|
||||
std::wstringbuf* const buf2 = sstrm1.rdbuf();
|
||||
std::wstreambuf* pbasebuf2 = active_buffer(sstrm1);
|
||||
VERIFY( buf1 == buf2 );
|
||||
VERIFY( buf1 == buf2 );
|
||||
VERIFY( pbasebuf1 != pbasebuf2 );
|
||||
VERIFY( pbasebuf2 == pbasebuf0 );
|
||||
|
||||
@ -56,7 +56,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::wstringbuf* psbuf = dynamic_cast<std::wstringbuf*>(pbasebuf2);
|
||||
#else
|
||||
std::wstringbuf* psbuf = static_cast<std::wstringbuf*>(pbasebuf2);
|
||||
#endif
|
||||
str02 = psbuf->str();
|
||||
VERIFY( str02 == str01 );
|
||||
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <sstream>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
redirect_buffer(std::wios& stream, std::wstreambuf* new_buf)
|
||||
void
|
||||
redirect_buffer(std::wios& stream, std::wstreambuf* new_buf)
|
||||
{ stream.rdbuf(new_buf); }
|
||||
|
||||
std::wstreambuf*
|
||||
@ -48,7 +48,7 @@ void test02()
|
||||
redirect_buffer(sstrm1, &sbuf);
|
||||
std::wstringbuf* const buf2 = sstrm1.rdbuf();
|
||||
std::wstreambuf* pbasebuf2 = active_buffer(sstrm1);
|
||||
VERIFY( buf1 == buf2 );
|
||||
VERIFY( buf1 == buf2 );
|
||||
VERIFY( pbasebuf1 != pbasebuf2 );
|
||||
VERIFY( pbasebuf2 == pbasebuf0 );
|
||||
|
||||
@ -56,7 +56,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::wstringbuf* psbuf = dynamic_cast<std::wstringbuf*>(pbasebuf2);
|
||||
#else
|
||||
std::wstringbuf* psbuf = static_cast<std::wstringbuf*>(pbasebuf2);
|
||||
#endif
|
||||
str02 = psbuf->str();
|
||||
VERIFY( str02 == str01 );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user