office-gobmx/external/pdfium/gcc-c++20-comparison.patch
Stephan Bergmann 07a09195ad external/pdfium: Latest MSVC now needs the GCC workaround, too
...or else a build with MS VS 2019 16.10.0 and --with-latest-c++ would cause a
stack overflow during CppunitTest_xmlsecurity_pdfsigning in the same way as
described at 6391e3c4dc "external/pdfium: Work
around GCC C++20 recursive comparison issue".  Interestingly, builds with recent
Clang (on various platforms) and --with-latest-c++ do not run into that stack
overflow issue, so it appears that Clang implements subtly different rules for
C++20 and beyond here than do GCC and MSVC.  (The GCC issue
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94141> "c++20 rewritten operator==
recursive call mixing friend and external operators for template class"
mentioned in external/pdfium/UnpackedTarball_pdfium.mk may not be the most
accurate description of the precise issue at hand here, but lets keep it at that
for now.  Its comments do mention "that some people are going to try and change
the rules to avoid breaking code like this.")

But regardless of what the exact rules are for C++20 and beyond, these
problematic overloads are only needed for C++17 and earlier anyway, as C++20 can
cover them with automatic rewrites of other operators.  So lets generally
disable them for C++20 and beyond.

Change-Id: I99033d6f09f069f00a6916ef40fd03dd4962a5c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116882
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-09 10:48:11 +02:00

18 lines
413 B
Diff

--- core/fxcrt/retain_ptr.h
+++ core/fxcrt/retain_ptr.h
@@ -135,6 +135,7 @@
mutable intptr_t m_nRefCount = 0;
};
+#if __cplusplus < 202002L
template <typename T, typename U>
inline bool operator==(const U* lhs, const RetainPtr<T>& rhs) {
return rhs == lhs;
@@ -144,6 +144,7 @@
inline bool operator!=(const U* lhs, const RetainPtr<T>& rhs) {
return rhs != lhs;
}
+#endif
} // namespace fxcrt