Title
Can conversion functions be static?
Status
cd1
Section
11.4.8.3 [class.conv.fct]
Submitter
Scott Meyers

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

Messages

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 11.4.8.3 [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 {
    public:
      static operator bool() { return true; }
    };

All my compilers hate it. I hate it, too. However, I don't see anything in 11.4.8.3 [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?

History
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