Fix for bug 794959 (Use the right cast in GetAs* functions of union types in new DOM bindings). r=bz.

--HG--
extra : rebase_source : 051181aa319edd386679119846fd61c574957b54
This commit is contained in:
Peter Van der Beken 2012-09-26 16:17:46 +02:00
parent 225e9ed8d3
commit 212ca8e4dc

View File

@ -3980,10 +3980,7 @@ class CGUnionStruct(CGThing):
${externalType} GetAs${name}() const
{
MOZ_ASSERT(Is${name}(), "Wrong type!");
// The cast to ${externalType} is needed to work around a bug in Apple's
// clang compiler, for some reason it doesn't call |S::operator T&| when
// casting S<T> to T& and T is forward declared.
return (${externalType})mValue.m${name}.Value();
return const_cast<${structType}&>(mValue.m${name}.Value());
}
${structType}& SetAs${name}()
{