Explorar o código

Merge pull request #30 from assimp/gcc-fixes

workaround for older gcc versions (<4.6) sometimes copying temporaries even though they shouldn't.
Alexander Gessler %!s(int64=12) %!d(string=hai) anos
pai
achega
863645e88b
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      code/TinyFormatter.h

+ 13 - 0
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 {