Bug 686280 - js::Move(temporary) should strip the const (also, this fixes build error caused by gcc 4.6 bug) (r=jimb)
authorLuke Wagner <luke@mozilla.com>
Mon, 19 Sep 2011 10:02:53 -0700
changeset 77151 724207df257a6085a40b6d9c4825a70c54336699
parent 77150 7c5740a2649ebdf22dc63c9c4d830502f6110a71
child 77152 e081de558f5945376ebcbd07a5c6cf30dda08bfe
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersjimb
bugs686280
milestone9.0a1
Bug 686280 - js::Move(temporary) should strip the const (also, this fixes build error caused by gcc 4.6 bug) (r=jimb)
js/src/jsutil.h
--- a/js/src/jsutil.h
+++ b/js/src/jsutil.h
@@ -819,13 +819,16 @@ class MoveRef {
     operator T &()  const { return *pointer; }
   private:
     T *pointer;
 };
 
 template<typename T>
 MoveRef<T> Move(T &t) { return MoveRef<T>(t); }
 
+template<typename T>
+MoveRef<T> Move(const T &t) { return MoveRef<T>(const_cast<T &>(t)); }
+
 } /* namespace js */
 
 #endif /* defined(__cplusplus) */
 
 #endif /* jsutil_h___ */