3106. nothrow should be inline constexpr rather that extern const

Section: 17.6.2 [new.syn] Status: NAD Submitter: Antony Polukhin Opened: 2018-04-25 Last modified: 2020-09-06 13:52:31 UTC

Priority: 2

View all issues with NAD status.


std::nothrow in [new.syn] is declared as 'extern const nothrow_t nothrow;'. Unfortunately this declaration requires linking with Standard Library (which does not work well on GCC with -nostdlib flag). Moreover the declaration differs from other Standard Library tags that are 'inline constexpr'.

[2018-06-18 after reflector discussion]

Priority set to 2

[2018-08-23 Batavia Issues processing]

Status to Tentatively NAD - if we had a status 'Wont Fix' that would be correct.

This is an ABI break for most implementations, and people can define their own variable of type std::nothrow_t if they want a constexpr one.

Proposed resolution:

This wording is relative to N4741.

  1. Edit 17.6.2 [new.syn] as indicated:

    struct nothrow_t { explicit nothrow_t() = default; };
    extern constinline constexpr nothrow_t nothrow;