Le 14/06/2016 16:38, Jean-Marc Lasgouttes a écrit :
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,
Yes, this should be synonymous.
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.
What errors does it give with the attached?
diff --git a/src/support/Changer.h b/src/support/Changer.h
index 8f24ba5..9d85c26 100644
--- a/src/support/Changer.h
+++ b/src/support/Changer.h
@@ -24,7 +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/RefChanger.h b/src/support/RefChanger.h
index 9b9d020..baf3d84 100644
--- a/src/support/RefChanger.h
+++ b/src/support/RefChanger.h
@@ -45,7 +45,19 @@ private:
bool enabled;
};
+
+//for gcc 4.6
+#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
+template <typename X>
+struct RefChanger : unique_ptr<RevertibleRef<X>>
+{
+ RefChanger(unique_ptr<RevertibleRef<X>> p)
+ : unique_ptr<RevertibleRef<X>>(move(p))
+ {}
+};
+#else
template <typename X> using RefChanger = unique_ptr<RevertibleRef<X>>;
+#endif
/// Saves the value of \param ref in a movable object