Status: New
Owner: ----
New issue 419 by piiguu: Two handles are equal even when they refer to
different objects
http://code.google.com/p/v8/issues/detail?id=419
The function below in Handle<T> class always returns true even two handles
refer to different objects
/**
* Checks whether two handles are the same.
* Returns true if both are empty, or if the objects
* to which they refer are identical.
* The handles' references are not checked.
*/
template <class S> bool operator==(Handle<S> that) const {
void** a = reinterpret_cast<void**>(**this);
void** b = reinterpret_cast<void**>(*that);
if (a == 0) return b == 0;
if (b == 0) return false;
return *a == *b;
}
Repro:
#include <v8.h>
#include <stdio.h>
class A
{
};
class B
{
};
int main()
{
A a;
B b;
Handle<A> ha(&a);
Handle<B> hb(&b);
if (ha == hb)
printf("equal!");
return 0;
}
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---