This is an archive of the discontinued LLVM Phabricator instance.

[c++] Implement P1957R0 - narrowing pointer-to-bool

Authored by lichray on Jul 1 2019, 2:04 PM.



This patch implements the Core language part. The
library part may need a version check.

A few details w.r.t. the paper:

  • The Annex D wording implies a C++20 change as requested by Core, but this forms a contradiction because that won't be available for US 212 which requests a fix for a DR against C++17. Therefore this patch implements the paper as a DR against C++11 for now.
  • This narrowing category does not consider whether the value fits or whether the object to convert from is a literal (MSVC).
  • nullptr to bool is not a conversion (although Clang thinks it is), so nullptr is outside the scope of this change.


Event Timeline

lichray created this revision.Jul 1 2019, 2:04 PM
lichray updated this revision to Diff 232752.Dec 8 2019, 7:10 PM

Regenerate the diff in Git, update description, link to paper.

lichray retitled this revision from [c++] Implement categorizing pointer-to-bool as narrowing conversions to [c++] Implement P1957R0 - narrowing pointer-to-bool.Dec 8 2019, 7:13 PM
lichray edited the summary of this revision. (Show Details)
lichray abandoned this revision.Dec 8 2020, 11:56 AM

Implemented in 7ef45f45f67.