This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
std::nullopt_tSection: 22.5.5 [optional.nullopt] Status: New Submitter: Jiang An Opened: 2026-08-11 Last modified: 2026-08-15
Priority: Not Prioritized
View all other issues in [optional.nullopt].
View all issues with New status.
Discussion:
LWG 4497(i) specified that std::nullopt_t is copyable and three-way comparable.
However, during implementing and testing its resolution in libc++, it was found that almost
no intended operation is specified to be have desired property - being noexcept or trivial,
or even constexpr for some special member functions. Maybe we should specify the details of
std::nullopt_t more precisely.
Proposed resolution:
This wording is relative to N5054.
Modify 22.5.5 [optional.nullopt] as indicated:
[Drafting note: It will become redundant to specify that
nullopt_tis empty, non-aggregate, and modeling certain concepts. In current implementations,nullopt_tdoes have some member type, so perhaps we shouldn't specify lack of member types.]
struct nullopt_t{see below// unspecified constructors friend strong_ordering operator<=>(nullopt_t, nullopt_t) = default; }; inline constexpr nullopt_t nullopt(unspecified);-1- The struct
-2- Typenullopt_tisan emptyclass type used as a unique type to indicate the state of not containing a value for optional objects. In particular,optional<T>has a constructor withnullopt_tas a single argument; this indicates that an optional object not containing a value shall be constructed.nullopt_tdoes not havea default constructor or an initializer-list constructor, and is not an aggregate.base class, non-static data member, default constructor, initializer-list constructor, or explicitly declared non-static member function that is not a constructor. All special member functions ofnullopt_tmodelscopyableandthree_way_comparable<strong_ordering>nullopt_tare implicitly declared.