From f8a30a87a9d0c68dc16d5fa2ca63f687b1d90da1 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Nov 2021 09:56:30 +0100 Subject: Fix (mis-)uses of temporary O[U]StringLiteral ...as sub-expressions of ternary operators, which happened to keep compiling after 4b9e440c51be3e40326bc90c33ae69885bfb51e4 "Turn OStringLiteral into a consteval'ed, static-refcound rtl_String" and e6dfaf9f44f9939abc338c83b3024108431d0f69 "Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uString" because both branches are of the same type O[U]StringLiteral, and which didn't cause any issues because no dangling pointers to those temporary objects escaped the surrounding full expressions. This was found with an experimental build with VS 2022 with --enable-latest-c++, which would support HAVE_CPP_CONSTEVAL after some linking fix in the configure.ac detection code (which is forthcoming in a later commit) and flagged all these uses in ternary operators as error C7595 "call to immediate function is not a constant expression". That error looks bogus (and it also caused a false > sd/source/ui/unoidl/unoobj.cxx(742): error C7595: 'Color::Color': call to immediate function is not a constant expression so HAVE_CPP_CONSTEVAL will need to remain undefined for VS 2022 until that compiler bug is fixed), but it nicely found all these cases that should arguably be cleaned up. Change-Id: I81de94e8af5a6c50e5fe7dfa1a4b253e0c2a68f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125082 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- unotest/source/cpp/filters-test.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'unotest') diff --git a/unotest/source/cpp/filters-test.cxx b/unotest/source/cpp/filters-test.cxx index a642c2176678..7adbd9ca4d4d 100644 --- a/unotest/source/cpp/filters-test.cxx +++ b/unotest/source/cpp/filters-test.cxx @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -107,7 +108,7 @@ void FiltersTest::recursiveScan(filterStatus nExpected, } OString aRes( - (bExport ? OStringLiteral("save") : OStringLiteral("load")) + " " + OString::Concat(bExport ? std::string_view("save") : std::string_view("load")) + " " + OUStringToOString(sURL, osl_getThreadTextEncoding())); OUString realUrl; -- cgit