Can nullptr be passed to an ellipsis?
Section [expr.call]
Alisdair Meredith

Created on 2008-09-25.00:00:00 last changed 143 months ago


Date: 2010-03-15.00:00:00

[Voted into WP at March, 2010 meeting.]

Date: 2010-02-15.00:00:00

Proposed resolution (February, 2010):

Change [expr.call] paragraph 7 as follows:

When there is no parameter for a given argument, the argument is passed in such a way that the receiving function can obtain the value of the argument by invoking va_arg (17.13 [support.runtime]). [Note: This paragraph does not apply to arguments passed to a function parameter pack. Function parameter packs are expanded during template instantiation (13.7.4 [temp.variadic]), thus each such argument has a corresponding parameter when a function template specialization is actually called. —end note] The lvalue-to-rvalue (7.3.2 [conv.lval]), array-to-pointer (7.3.3 [conv.array]), and function-to-pointer (7.3.4 [conv.func]) standard conversions are performed on the argument expression. An argument that has (possibly cv-qualified) type std::nullptr_t is converted to type void* (7.3.12 [conv.ptr]). After these conversions...
Date: 2009-10-15.00:00:00

Notes from the October, 2009 meeting:

The CWG agreed that this should be supported and the effect should be like passing (void*)nullptr.

Date: 2008-09-25.00:00:00

The current wording of [expr.call] paragraph 7 is:

After these conversions, if the argument does not have arithmetic, enumeration, pointer, pointer to member, or effective class type, the program is ill-formed.

It's not clear whether this is intended to exclude anything other than void, but the effect is to disallow passing nullptr to ellipsis. That seems unnecessary.

Date User Action Args
2010-03-29 00:00:00adminsetmessages: + msg2674
2010-03-29 00:00:00adminsetstatus: tentatively ready -> cd2
2010-02-16 00:00:00adminsetmessages: + msg2494
2010-02-16 00:00:00adminsetstatus: drafting -> tentatively ready
2009-11-08 00:00:00adminsetmessages: + msg2383
2009-08-03 00:00:00adminsetstatus: open -> drafting
2008-09-25 00:00:00admincreate