Bug 902485. Disallow copy constructors and operator= on WebIDL union structs, because those wouldn't do what you think they should. r=dzbarsky

This commit is contained in:
Boris Zbarsky 2013-08-07 17:40:00 -04:00
parent 58ee763141
commit 42d2829264
2 changed files with 15 additions and 0 deletions

View File

@ -1623,6 +1623,13 @@ public:
void Destroy() {
storage.addr()->~T();
}
private:
// Disallow the assignment operator, because we have no idea what the right
// way to assign T is, and bitwise copying is likely to be wrong. Sadly,
// we can't disallow copy-construction here, because we need to have no
// constructor, since we're used in a union...
void operator=(const UnionMember<T>& aOther) MOZ_DELETE;
};
template<typename T>

View File

@ -6105,6 +6105,10 @@ ${methods}
private:
friend class ${structName}Argument;
// Disallow copy-construction and assignment
${structName}(const ${structName}&) MOZ_DELETE;
void operator=(const ${structName}&) MOZ_DELETE;
${destructors}
enum Type {
@ -6228,6 +6232,10 @@ ${methods}
JS::MutableHandle<JS::Value> rval) const;
private:
// Disallow copy-construction and assignment
${structName}ReturnValue(const ${structName}ReturnValue&) MOZ_DELETE;
void operator=(const ${structName}ReturnValue&) MOZ_DELETE;
enum Type {
eUninitialized,
${enumValues}