include/rtl/ustring.hxx                             |    2 +-
 sal/qa/rtl/strings/test_oustring_stringliterals.cxx |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e83e62fe376a91f7270435e06ee7f6864c48fb4b
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Jul 19 08:27:02 2023 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Jul 19 10:24:45 2023 +0200

    Work around MSVC bug with "..."_ostr vs. u"..."_ostr
    
    Since 27d1f3ac016d77d3c907cebedca558308f366855 "O[U]String literals 
(unusable
    for now, C++20 only)",
    
<https://developercommunity.visualstudio.com/t/Using-same-string-literal-suffix-for-cha/10416970>
    "Using same string literal suffix for char and char16_t string overloads 
causes
    'no matching overloaded function found'" caused --with-latest-c++ builds to 
fail
    with
    
    > sal/qa/rtl/strings/test_oustring_stringliterals.cxx(432): error C2672: 
'""_ostr': no matching overloaded function found
    > include\rtl/ustring.hxx(3604): note: could be 'rtlunittest::OUString 
operator ""_ostr(void)'
    > include\rtl/string.hxx(2402): note: or       'rtlunittest::OString 
operator ""_ostr(void)'
    > sal/qa/rtl/strings/test_oustring_stringliterals.cxx(432): error C2672: 
'CppUnit::assertEquals': no matching overloaded function found
    > workdir\UnpackedTarball\cppunit\include\cppunit/TestAssert.h(161): note: 
could be 'void CppUnit::assertEquals(const T &,const T 
&,CppUnit::SourceLine,const std::string &)'
    > sal/qa/rtl/strings/test_oustring_stringliterals.cxx(432): note: 'void 
CppUnit::assertEquals(const T &,const T &,CppUnit::SourceLine,const std::string 
&)': expects 4 arguments - 3 provided
    
    etc.  So help MSVC along by renaming from u"..."_ostr to u"..."_ustr for 
now.
    
    Change-Id: Iad401f0681ac9326b7c57259c5483263ddfbfd4e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154634
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 67275ee07932..90b195754a17 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -3601,7 +3601,7 @@ constexpr
     rtlunittest::
 #endif
     OUString
-operator ""_ostr() {
+operator ""_ustr() {
     return
 #if defined RTL_STRING_UNITTEST
         rtlunittest
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx 
b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index d2f471ba61fc..709ddb669cc5 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -429,9 +429,9 @@ void test::oustring::StringLiterals::checkEmbeddedNul() {
 
 void test::oustring::StringLiterals::checkOstr() {
 #if __cplusplus >= 202002L
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), u""_ostr.getLength());
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(6), u"foobar"_ostr.getLength());
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(7), u"foo\0bar"_ostr.getLength());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), u""_ustr.getLength());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6), u"foobar"_ustr.getLength());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(7), u"foo\0bar"_ustr.getLength());
 #endif
 }
 

Reply via email to