diff options
Diffstat (limited to 'sal/qa/rtl')
-rw-r--r-- | sal/qa/rtl/strings/test_ostring_concat.cxx | 7 | ||||
-rw-r--r-- | sal/qa/rtl/strings/test_oustring_concat.cxx | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx index b2adc17272d6..80fa62df6be5 100644 --- a/sal/qa/rtl/strings/test_ostring_concat.cxx +++ b/sal/qa/rtl/strings/test_ostring_concat.cxx @@ -147,6 +147,13 @@ void test::ostring::StringConcat::checkInvalid() rtl_uString* rus = nullptr; CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "b" ) + rs )); CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "b" ) + rus )); + +#if 0 + // Should fail to compile, to avoid use of OStringConcat lvalues that + // contain dangling references to temporaries: + auto const conc = OStringLiteral("foo") + "bar"; + (void) OString(conc); +#endif } }} // namespace diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx index 0cf305f9b133..1af3f60dd3aa 100644 --- a/sal/qa/rtl/strings/test_oustring_concat.cxx +++ b/sal/qa/rtl/strings/test_oustring_concat.cxx @@ -157,6 +157,13 @@ void test::oustring::StringConcat::checkInvalid() rtl_uString* rus = nullptr; CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "b" ) + rs )); CPPUNIT_ASSERT( INVALID_CONCAT( OUString( "b" ) + rus )); + +#if 0 + // Should fail to compile, to avoid use of OUStringConcat lvalues that + // contain dangling references to temporaries: + auto const conc = OUStringLiteral("foo") + "bar"; + (void) OUString(conc); +#endif } }} // namespace |