summaryrefslogtreecommitdiffstats
path: root/libraries/podofo/gcc12.patch
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/podofo/gcc12.patch')
-rw-r--r--libraries/podofo/gcc12.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/libraries/podofo/gcc12.patch b/libraries/podofo/gcc12.patch
new file mode 100644
index 0000000000..1bd71721e3
--- /dev/null
+++ b/libraries/podofo/gcc12.patch
@@ -0,0 +1,39 @@
+From d0e9f5d503b0cb79516ec9bff989f3d7d625b678 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <toscano.pino@tiscali.it>
+Date: Sun, 14 Aug 2022 08:27:13 +0200
+Subject: [PATCH] Fix declaration of operator<< for PoDoFo::PdfString
+
+Since PdfString is in the PoDoFo namespace, the operator<< for it must
+be in the same namespace as well, otherwise it is not found. In
+particular, operator<<(std::ostream&) is needed by cppunit as a way to
+get the string representation of an arbitrary type, when using
+CPPUNIT_ASSERT_EQUAL() on instances of it.
+
+This used to work with GCC until 11 because of a buggy behaviour.
+GCC 12 fixed it [1], causing this test to fail to build with it.
+
+[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51577
+---
+ test/unit/StringTest.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/test/unit/StringTest.cpp b/test/unit/StringTest.cpp
+index a7841f78..b52b7880 100644
+--- a/test/unit/StringTest.cpp
++++ b/test/unit/StringTest.cpp
+@@ -29,11 +29,15 @@ using namespace PoDoFo;
+ // Registers the fixture into the 'registry'
+ CPPUNIT_TEST_SUITE_REGISTRATION( StringTest );
+
++namespace PoDoFo {
++
+ inline std::ostream& operator<<(std::ostream& o, const PdfString& s)
+ {
+ return o << s.GetStringUtf8();
+ }
+
++}
++
+ void StringTest::setUp()
+ {
+ }