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


296. Can conversion functions be static?

Section:  [class.conv.fct]     Status: CD1     Submitter: Scott Meyers     Date: 5 Jul 2001

[Moved to DR at October 2002 meeting.]

May user-defined conversion functions be static? That is, should this compile?

    class Widget {
      static operator bool() { return true; }

All my compilers hate it. I hate it, too. However, I don't see anything in [class.conv.fct] that makes it illegal. Is this a prohibition that arises from the grammar, i.e., the grammar doesn't allow "static" to be followed by a conversion-function-id in a member function declaration? Or am I just overlooking something obvious that forbids static conversion functions?

Proposed Resolution (4/02):

Add to [class.conv.fct] as a new paragraph 7:

Conversion functions cannot be declared static.