Closed Bug 613766 Opened 15 years ago Closed 15 years ago

Fallible operator new doesn't compile with MSVC

Categories

(Core :: XPCOM, defect)

All
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bent.mozilla, Unassigned)

References

Details

The following line compiles and runs just fine on OS X (and linux, I assume): Block *b = new (fallible_t()) Block(); MSVC instead issues several errors: * <filename>: error C2066: cast to function type is illegal * <filename>: error C2440: 'initializing' : cannot convert from 'mozilla::fallible_t (__cdecl **)(void)' to 'EdgePool::Block *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Am I doing something wrong or is fallible new no longer possible with MSVC? The cycle collector was written with OOM taken into consideration and we'd like to make it handle OOM gracefully without aborting. This might need to block.
blocking2.0: --- → ?
Does it work with mozilla::fallible_t() ? (Could it be a namespace issue?)
No, it's able to see mozilla::fallible_t in that error message.
I don't see anything wrong with what we're doing. Could you try static fallible_t fallible = fallible_t(); Block* b = new (fallible) Block(); ? Maybe this is a bug in the VC parser ...
That seems to have worked, yeah.
Status: NEW → RESOLVED
blocking2.0: ? → ---
Closed: 15 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.