Bug 1339652 - Delete UnionMember's copy constructor, because it can't safely be used in the C++ object model. r=bz
authorJeff Walden <jwalden@mit.edu>
Tue, 14 Feb 2017 11:23:40 -0800
changeset 373456 01231e42dd09112c83c6dce35dd732136fb8154d
parent 373455 83c513bf2e8843b445bfc5768bba6190543894bc
child 373457 9f6b33bc6c2b2d422161dfee5d9dabfa34277ecd
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1339652
milestone54.0a1
Bug 1339652 - Delete UnionMember's copy constructor, because it can't safely be used in the C++ object model. r=bz
dom/bindings/UnionMember.h
--- a/dom/bindings/UnionMember.h
+++ b/dom/bindings/UnionMember.h
@@ -16,17 +16,24 @@ namespace dom {
 
 // The union type has an enum to keep track of which of its UnionMembers has
 // been constructed.
 template<class T>
 class UnionMember
 {
   AlignedStorage2<T> mStorage;
 
+  // Copy construction can't be supported because C++ requires that any enclosed
+  // T be initialized in a way C++ knows about -- that is, by |new| or similar.
+  UnionMember(const UnionMember&) = delete;
+
 public:
+  UnionMember() = default;
+  ~UnionMember() = default;
+
   T& SetValue()
   {
     new (mStorage.addr()) T();
     return *mStorage.addr();
   }
   template <typename T1>
   T& SetValue(const T1& aValue)
   {