Title
const-default-constructible improperly handles std::meta::info
Status
ready
Section
9.5.1 [dcl.init.general]
Submitter
US

Created on 2025-10-01.00:00:00 last changed 1 month ago

Messages

Date: 2025-10-24.22:41:53

Proposed resolution (approved by CWG 2025-10-24):

Change in 9.5.1 [dcl.init.general] paragraph 8 as follows (add bullets):

A class type cv T is const-default-constructible if
  • T is std::meta::info;
  • T is std::nullptr_t;
  • default-initialization of T would invoke a user-provided constructor of T (not inherited from a base class);
  • or if T is a class type where
    • each direct non-variant non-static data member M of T has a default member initializer or, if M is of class type X (or array thereof), X is const-default-constructible type,
    • if T is a union with at least one non-static data member, exactly one variant member has a default member initializer,
    • if T is not a union, for the type of each anonymous union member is const-default-constructible with at least one non-static data member (if any), exactly one non-static data member has a default member initializer, and
    • each potentially constructed base class of T is const-default-constructible.; or
  • T is an array of const-default-constructible type.
If a program calls for the default-initialization of an object of a const-qualified type T, T shall be std::meta::info or a const-default-constructible class type, or array thereof.
Date: 2025-10-24.22:41:53
N5028 comment USĀ 39-076

A class that contains only std::meta::info data members, or arrays thereof, should be const-default-constructible.

History
Date User Action Args
2025-11-06 23:04:52adminsetstatus: tentatively ready -> ready
2025-10-24 22:41:53adminsetmessages: + msg8175
2025-10-24 22:41:53adminsetstatus: open -> tentatively ready
2025-10-01 00:00:00admincreate