summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-08-04 13:31:39 +0200
committerStephan Bergmann <sbergman@redhat.com>2023-08-04 16:18:38 +0200
commit6c15598a3ff60b3d078fa9bf8b3b077c16343517 (patch)
tree4d0934dc4f75ecf9d14ae86e2271b65c01806f49 /sal
parentb1c339686cf0e1cb3cbbc40618a191bc31f8993f (diff)
Avoid a Clang template instantiation bug with libstdc++ and C++20
See patch set 2 of <https://gerrit.libreoffice.org/c/core/+/155121/2> "Bump baseline to C++20" for how that would affect us here, > /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/basic_string.h:620: error: undefined reference to 'void std::__cxx11::basic_string<char16_t, std::char_traits<char16_t>, std::allocator<char16_t> >::_M_construct<char16_t const*>(char16_t const*, char16_t const*, std::forward_iterator_tag)' > clang-12: error: linker command failed with exit code 1 (use -v to see invocation) > make[1]: *** [/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/solenv/gbuild/LinkTarget.mk:841: /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/LinkTarget/CppunitTest/libtest_sal_rtl.so] Error 1 (<https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/145874/>) Change-Id: Ibda1a5687a16e45aa0e77958f2bf547766cb0f48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155343 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/rtl/strings/test_oustring_stringliterals.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index 2f4de194928d..6c653f118935 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -419,7 +419,15 @@ void test::oustring::StringLiterals::checkEmbeddedNul() {
CPPUNIT_ASSERT(s.startsWith(a));
CPPUNIT_ASSERT(s.startsWith(p));
CPPUNIT_ASSERT(s.startsWith(u"foo\0hidden"));
+ // For Clang against libstdc++ with C++20 and greater, this would hit not-yet-fixed
+ // <https://github.com/llvm/llvm-project/issues/24502> "eagerly-instantiated entities whose
+ // templates are defined after the first point of instantiation don't get instantiated at all"
+ // (see the mailing list thread starting at
+ // <https://gcc.gnu.org/pipermail/libstdc++/2021-November/053548.html> "std::basic_string<_Tp>
+ // constructor point of instantiation woes?"):
+#if !(defined __clang__ && defined __GLIBCXX__ && __cplusplus >= 202002L)
CPPUNIT_ASSERT(!s.startsWith(u"foo\0hidden"s));
+#endif
CPPUNIT_ASSERT(!s.startsWith(u"foo\0hidden"sv));
/*TODO:*/
CPPUNIT_ASSERT(!s.startsWith(rtlunittest::OUStringLiteral(a)));