mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1295343 - Fix a strict aliasing warning in js::WeakMap. The resulting code will additionally fail to compile if you instantiate it with an invalid key type.
--HG-- extra : rebase_source : 5466eec299bbbae550e8fdca32e44c45ef45b695
This commit is contained in:
parent
021a12c86f
commit
cfe23d1b52
@ -179,8 +179,10 @@ class WeakMap : public HashMap<Key, Value, HashPolicy, RuntimeAllocPolicy>,
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(marked);
|
MOZ_ASSERT(marked);
|
||||||
|
|
||||||
gc::Cell* l = origKey.asCell();
|
// If this cast fails, then you're instantiating the WeakMap with a
|
||||||
Ptr p = Base::lookup(reinterpret_cast<Lookup&>(l));
|
// Lookup that can't be constructed from a Cell*. The WeakKeyTable
|
||||||
|
// mechanism is indexed with a GCCellPtr, so that won't work.
|
||||||
|
Ptr p = Base::lookup(static_cast<Lookup>(origKey.asCell()));
|
||||||
MOZ_ASSERT(p.found());
|
MOZ_ASSERT(p.found());
|
||||||
|
|
||||||
Key key(p->key());
|
Key key(p->key());
|
||||||
|
Loading…
Reference in New Issue
Block a user