This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of TS status.

2555. [fund.ts.v2] No handling for over-aligned types in optional

Section: 5.3 [fund.ts.v2::optional.object] Status: TS Submitter: Marshall Clow Opened: 2015-11-03 Last modified: 2018-07-08

Priority: 0

View all other issues in [fund.ts.v2::optional.object].

View all issues with TS status.

Discussion:

Addresses: fund.ts.v2

22.5.3 [optional.optional] does not specify whether over-aligned types are supported. In other places where we specify allocation of user-supplied types, we state that "It is implementation-defined whether over-aligned types are supported (3.11)." (Examples: 7.6.2.8 [expr.new]/p1, 20.2.10.2 [allocator.members]/p5, [temporary.buffer]/p1). We should presumably do the same thing here.

Proposed resolution:

This wording is relative to N4562.

  1. Edit 22.5.3 [optional.optional]/p1 as follows::

    […] The contained value shall be allocated in a region of the optional<T> storage suitably aligned for the type T. It is implementation-defined whether over-aligned types are supported (C++14 §3.11). When an object of type optional<T> is contextually converted to bool, the conversion returns true if the object contains a value; otherwise the conversion returns false.