This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


1549. Overloaded comma operator with void operand

Section: 12.4.3  [over.binary]     Status: open     Submitter: Nikolay Ivchenkov     Date: 2012-09-04

Even though a function cannot take a parameter of type void, the current rules for overload resolution require consideration of overloaded operators when one operand has a user-defined or enumeration type and the other has type void. This can result in side effects and possibly errors, for example:

  template <class T> struct A {
    T t;
    typedef T type;

  struct X {
    typedef A<void> type;

  template <class T> void operator ,(typename T::type::type, T) {}

  int main() {
    X(), void(); // OK
    void(), X(); // error: A<void> is instantiated with a field of
                 // type void