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


644. Should a trivial class type be a literal type?

Section:6.9  [basic.types]    Status:CD1    Submitter:Alisdair Meredith    Date:8 Aug 2007

[Voted into the WP at the June, 2008 meeting.]

The original proposed wording for 6.9 [basic.types] paragraph 11required a constexpr constructor for a literal classonly “if the class has at least one user-declaredconstructor.” This wording was dropped during thereview by CWG out of a desire to ensure that literal types nothave any uninitialized members. Thus, a class like

    struct pixel {        int x, y;    };

is not a literal type. However, if an object of that type isaggregate-initialized or value-initialized, there can be nouninitialized members; the missing wording should be restored inorder to permit use of expressions likepixel().x asconstant expressions.

Proposed resolution (February, 2008):

Change 6.9 [basic.types] paragraph 10 as follows:

A type is aliteral type if it is:



[8]ページ先頭

©2009-2026 Movatter.jp