Movatterモバイル変換


[0]ホーム

URL:


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

2025-12-20


296. Can conversion functions be static?

Section:11.4.8.3  [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 thiscompile?

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

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

Proposed Resolution (4/02):

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

Conversion functions cannot be declaredstatic.



[8]ページ先頭

©2009-2026 Movatter.jp