C++ Logo

sg10

Advanced search

[SG10] Macro for P1957R2 Converting from T* to bool should be considered narrowing

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Tue, 23 Jun 2020 09:12:38 +0100
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1957r2.html makes
changes to both the core and library wording. I can implement the library
part, but I have no idea if the compiler being used to compile my library
implements the core part. Specifically, the current production releases of
Clang and Intel icc do not implement the core part yet (Clang trunk does).

We probably should have added a macro for it, so the library can tell
whether it needs to prevent narrowing to bool, or if it can trust the
compiler.

I don't suggest adding one now though. If a macro existed I'd have used it,
but I'm just going to rip out the bool-narrowing code from libstdc++, and
so variant<bool>{""} will compile with Clang 10.0.0 or icc 19.0.1, but not
with GCC trunk or Clang trunk.

Received on 2020-06-23 03:16:05