Can conversion functions be static?
Section [class.conv.fct]
Scott Meyers

Created on 2001-07-05.00:00:00 last changed 161 months ago


Date: 2002-10-15.00:00:00

[Moved to DR at October 2002 meeting.]

Date: 2002-04-15.00:00:00

Proposed Resolution (4/02):

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

Conversion functions cannot be declared static.
Date: 2001-07-05.00:00:00

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?

Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2003-04-25 00:00:00adminsetstatus: dr -> wp
2002-11-08 00:00:00adminsetmessages: + msg777
2002-11-08 00:00:00adminsetstatus: ready -> dr
2002-05-10 00:00:00adminsetmessages: + msg616
2002-05-10 00:00:00adminsetstatus: open -> ready
2001-07-05 00:00:00admincreate