3139. contract_violation's special member functions

Section: 99 [support.contract.cviol] Status: NAD Submitter: Tim Song Opened: 2018-07-10 Last modified: 2019-08-05 16:05:14 UTC

Priority: 1

View all other issues in [support.contract.cviol].

View all issues with NAD status.


contract_violation is currently defined as:

class contract_violation {
  uint_least32_t line_number() const noexcept;
  string_view file_name() const noexcept;
  string_view function_name() const noexcept;
  string_view comment() const noexcept;
  string_view assertion_level() const noexcept;

which implies a full set of defaulted special member functions with entirely unclear semantics, and can arguably be read to imply that it is an aggregate.

It seems unlikely that we meant for users to default construct or copy contract_violation objects, but if we did want to do that, we need to at least specify the behavior of a default constructed contract_violation object and how copying and moving work with respect to the lifetime of the strings referenced by the string_views returned by its member functions.

[2018-11 Reflector prioritization]

Set Priority to 1

[2019 Cologne Wednesday night]

= delete for copy/move assignment; Status to 'Open'; Daniel to provide wording

[Post Cologne Mailing]

Contracts were removed from the C++20 draft in Cologne; closing as NAD.

Proposed resolution: