A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cplusplus/draft/issues/3576 below:

[meta.rel] is_nothrow_convertible does not clearly require nothrow destruction LWG 3400, LWG 2116 · Issue #3576 · cplusplus/draft · GitHub

By @Dani-Hub , is_nothrow_convertible considers destruction of the converted object (if To is an object type) or the temporary (if To is a reference type and the temporary to bind would be created) by design. And known implementations (msvc, libc++, libstdc++) behave correctly.

For example, given a type Weird defined as

struct Weird {
  Weird(int) noexcept {}
  ~Weird() noexcept(false) {}
};

Then std::is_nothrow_convertible_v<int, Weird> is false.

However, I suspect that wording in [meta.rel]/5 only requires the well-formedness, and whether the destruction after the initialization of To is considered as part of the conversion is not mentioned.
So "the conversion, as defined by is_­convertible" in the specification of is_nothrow_convertible might not be precisely defined, and may lead to unintended comprehension, e.g. std::is_nothrow_convertible_v<int, Weird> can be true since the converting constructor itself is noexcept, although destruction of Weird is not.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4