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:
Jonathan Wakely 2021-02-12 11:09:00 +00:00
parent 14b554c462
commit e9c3105211
6 changed files with 42 additions and 18 deletions

View File

@ -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 );

View File

@ -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 );

View File

@ -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 );

View File

@ -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 );

View File

@ -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 );

View File

@ -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 );