Closed Bug 745361 Opened 8 years ago Closed 8 years ago
Handle conversion rules totally break static typing
This type checks but I don't think it should RootedVarString r(...); HandleObject h = r; I think the solution is to remove this constructor and fix other things with explicit (restrict) casts. template <class T> template <class U> Handle<T>::Handle(const RootedVar<U> &); and the analogous one for Root<U>. Also, can we move Handle out of jsprvtd.h?
Oops, this constructor was missing a testAssign, which is supposed to only allow handle assignments that follow normal C++ assignment rules for the wrapped type. See the other Handle constructors, which are also templated on a type other than the handle. Requiring casts whenever converting between handles of different but compatible types would be a mess I think, with all the subclassing we do for objects and strings.
Assignee: general → bhackett1024
Attachment #615047 - Flags: review?(luke)
Comment on attachment 615047 [details] [diff] [review] patch Ahh, I didn't see testAssign. Cool.
Attachment #615047 - Flags: review?(luke) → review+
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
You need to log in before you can comment on or make changes to this bug.