Le 14/06/2016 à 16:39, Guillaume Munch a écrit :
I am a little short on ideas so we could try the attached, and if it
does not work try the commented version below it, and if it does not
work, revert e87febd0 for the moment. What I am concerned about is
future breakages, about which I will ask that you be patient (as you
have been so far—thank you). I do not have g++ 4.6, so I will set up my
test-before-commit build with g++ 4.8 and fixes for 4.6 will be done as
breakages happen.

The second version did work. I managed to get around the new aliasing thing in Changer.h using a plain old typedef, but of course RefChange<X> proved more difficult. I tried to define it as a subclass of unique_ptr<RevertibleRef<X>>, but then my C++11 default skills showed their weakness.

Here is what I have right now. If we manage to get somewhere we should keep both the new shiny constructs and the old crufty ones, guarded by the appropriate #ifdef.

JMarc



diff --git a/src/support/Changer.h b/src/support/Changer.h
index 8f24ba5..e395147 100644
--- a/src/support/Changer.h
+++ b/src/support/Changer.h
@@ -24,8 +24,9 @@ struct Revertible {
 	virtual void keep() {}
 };
 
-using Changer = unique_ptr<Revertible>;
-
+// for gcc 4.6
+//using Changer = unique_ptr<Revertible>;
+typedef unique_ptr<Revertible> Changer;
 
 }
 
diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp
index 187d018..c1bc5df 100644
--- a/src/support/unicode.cpp
+++ b/src/support/unicode.cpp
@@ -66,6 +66,14 @@ IconvProcessor::IconvProcessor(string tocode, string fromcode)
 {}
 
 
+// for gcc 4.6
+//IconvProcessor::IconvProcessor(IconvProcessor &&) = default;
+IconvProcessor::IconvProcessor(IconvProcessor && other)
+	: tocode_(move(other.tocode_)), fromcode_(move(other.fromcode_)),
+	  h_(move(other.h_))
+{}
+
+
 bool IconvProcessor::init()
 {
 	if (h_)
diff --git a/src/support/unicode.h b/src/support/unicode.h
index 6373e47..17b95dd 100644
--- a/src/support/unicode.h
+++ b/src/support/unicode.h
@@ -62,8 +62,8 @@ public:
 		char * out_buffer, size_t max_out_size);
 	/// target encoding
 	std::string to() const { return tocode_; }
-	// required by g++ 4.7
-	IconvProcessor(IconvProcessor &&) = default;
+	// required by g++ 4.6
+	IconvProcessor(IconvProcessor && other);
 };
 
 /// Get the global IconvProcessor instance of the current thread for

Reply via email to