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

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

Messages

Date: 2025-10-01.00:00:00
N5028 comment USĀ 39-076

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

Possible resolution:

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

A class type T is const-default-constructible if
  • default-initialization of T would invoke a user-provided constructor of T (not inherited from a base class);
  • T is std::meta::info;
  • 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.
History
Date User Action Args
2025-10-01 00:00:00admincreate