Prevent calls to ReturnValue::Set with pointer-valued types.
authorvogelheim@chromium.org <vogelheim@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 9 May 2014 12:07:38 +0000 (12:07 +0000)
committervogelheim@chromium.org <vogelheim@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 9 May 2014 12:07:38 +0000 (12:07 +0000)
commit6b1f74260acd8b0a05e22b376c6854e82d079040
tree063006ca194d2a2c3fd6e2bb6adb1333c89ccd0b
parente8547d3ffe41fc46cdfe49631c26d5786960d63d
Prevent calls to ReturnValue::Set with pointer-valued types.

Currently, this code will compile:
  SomePointer* p = ...;
  ReturnValue r = ...;
  r.Set(p);

What happens is that ReturnValue::Set has no pointer-ish overloads, but
a bool one, and hence C++ will convert the pointer to a bool and use
the Set(bool) overload. In other words, the example above is equivalent
to: r.Set(p ? true : false); Which probably isn't what the author had
in mind. This change adds a Set(void*) overload whose body forces a
compile error, to prevent this from happening inadvertently. The only
use of this indeed turned out to be an error.

(Wait for issue 364025 before submitting.)

BUG=
R=dcarney@chromium.org

Review URL: https://codereview.chromium.org/240013004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21217 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
include/v8.h