This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


2003. Zero-argument macros incorrectly specified

Section: 15.6  [cpp.replace]     Status: drafting     Submitter: Richard Smith     Date: 2014-09-12

According to 15.6 [cpp.replace] paragraph 4,

If the identifier-list in the macro definition does not end with an ellipsis, the number of arguments (including those arguments consisting of no preprocessing tokens) in an invocation of a function-like macro shall equal the number of parameters in the macro definition.

That is, a sequence of no preprocessing tokens counts as an argument. That phrasing has problems with zero-argument function-like macros, e.g.,

  #define M()
  M();

M is defined as having no parameters but the invocation has one (empty) argument, which does not match the number of parameters in the definition.