Closed Bug 1380092 Opened 7 years ago Closed 7 years ago

error: cannot convert ‘std::nullptr_t’ to ‘uintptr_t {aka unsigned int}’

Categories

(Core :: IPC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: tjr, Assigned: tjr)

References

(Blocks 1 open bug)

Details

(Whiteboard: [tor])

Attachments

(1 file)

I get the following error when building with MinGW:

> In file included from /home/tom/Documents/moz/mingw-work/just-build-6/obj-mingw/ipc/mscom/Unified_cpp_ipc_mscom0.cpp:56:0:
> /home/tom/Documents/moz/mingw-work/just-build-6/ipc/mscom/Utils.cpp: In function ‘uintptr_t mozilla::mscom::GetContainingModuleHandle()’:
> /home/tom/Documents/moz/mingw-work/just-build-6/ipc/mscom/Utils.cpp:95:12: error: cannot convert ‘std::nullptr_t’ to ‘uintptr_t {aka unsigned int}’ in return
>   return nullptr;

https://stackoverflow.com/questions/13092266/why-cant-nullptr-convert-to-int explains why it is not valid to cast nullptr to an int and https://stackoverflow.com/questions/1845482/what-is-uintptr-t-data-type#1846648 explains that uintptr_t is an unsigned int that happens to be large enough to hold a pointer.

Based on these, I believe that the use of nullptr here is incorrect and it should instead be NULL.
Attachment #8885400 - Flags: review?(jld)
Comment on attachment 8885400 [details]
Bug 1380092 Return 0 instead of nullptr

https://reviewboard.mozilla.org/r/156248/#review161404

I'd use 0 instead of NULL, since it's an integer type.
Attachment #8885400 - Flags: review?(jld) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f4a8816b477d
Return 0 instead of nullptr r=jld
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f4a8816b477d
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: