From 17e2588588fb282713dd1652f04e010b9d58dcd8 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Sat, 13 Apr 2013 16:08:13 +0200 Subject: [PATCH] - workaround for older gcc versions (<4.6) sometimes copying temporaries even though they shouldn't. --- code/TinyFormatter.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/code/TinyFormatter.h b/code/TinyFormatter.h index 6cacfacc3..ac6d3d6d4 100644 --- a/code/TinyFormatter.h +++ b/code/TinyFormatter.h @@ -90,6 +90,19 @@ public: underlying << sin; } + + // The problem described here: + // https://sourceforge.net/tracker/?func=detail&atid=1067632&aid=3358562&group_id=226462 + // can also cause trouble here. Apparently, older gcc versions sometimes copy temporaries + // being bound to const ref& function parameters. Copying streams is not permitted, though. + // This workaround avoids this by manually specifying a copy ctor. +#if !defined(__GNUC__) || !defined(__APPLE__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) + basic_formatter(const basic_formatter& other) { + underlying << (string)other; + } +#endif + + public: operator string () const {