Created on 2006-04-22.00:00:00 last changed 76 months ago
[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]
Proposed resolution (August, 2011):
Change 11.3.5 [dcl.fct] paragraph 4 as follows:
...If the parameter-declaration-clause is empty, the function takes no arguments.
The parameter list (void)is equivalent to theempty parameter list. Except for this special case, void shall not be a parameter type (though types derived from void, such as void*, can). If the parameter-declaration-clause terminates...
This resolution also resolves issue 332.
Notes from the October, 2006 meeting:
The CWG did not take a formal position on this issue; however, there was some concern expressed over the treatment of function templates and member functions of class templates if the C++ rule were changed: for a template parameter T, would a function taking a single parameter of type T become a no-parameter function if it were instantiated with T = void?
11.3.5 [dcl.fct] paragraph 2 says,
The parameter list (void) is equivalent to the empty parameter list.
This special case is intended for C compatibility, but C99 describes it differently (22.214.171.124 paragraph 10):
The special case of an unnamed parameter of type void as the only item in the list specifies that the function has no parameters.
The C99 formulation allows typedefs for void, while C++ (and C90) accept only the keyword itself in this role. Should the C99 approach be adopted?
|2014-03-03 00:00:00||admin||set||status: drwp -> cd3|
|2012-11-03 00:00:00||admin||set||status: dr -> drwp|
|2012-02-27 00:00:00||admin||set||messages: + msg3810|
|2012-02-27 00:00:00||admin||set||status: ready -> dr|
|2011-09-06 00:00:00||admin||set||messages: + msg3461|
|2011-09-06 00:00:00||admin||set||status: open -> ready|
|2006-11-05 00:00:00||admin||set||messages: + msg1421|