The macro definitions of NS_STATIC_CAST, NS_CONST_CAST, and NS_REINTERPRET_CAST are not protected properly with parentheses. This can lead to order-of-operations errors, as a trivial example: NS_REINTERPRET_CAST(nsISupports*,somevoidpointer)->AddRef(); will fail because -> is higher precedence than the cast operator. Patch forthcoming.
Oops, accidentally clicked wrong component.
Status: NEW → ASSIGNED
Component: XP Toolkit/Widgets: XUL → XPCOM
QA Contact: shrir → scc
static_cast<T>() has the parentheses as part of the syntax -- see C++ section 5.2 clause 1. The pattern that you say won't work is used all over the codebase (for example, the first occurrence of NS_STATIC_CAST in nsBlockFrame.cpp), so I don't think there are any compilers that do this wrong, either.
Oops, my bad. I misunderstood a compiler error during casting.
Status: ASSIGNED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.