[PATCH] D148800: [C2x] Update 'nullptr' implementation based on CD comments

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 20 06:46:48 PDT 2023


aaron.ballman created this revision.
aaron.ballman added reviewers: rsmith, clang-language-wg, efriedma, rjmccall, erichkeane.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.

We filed some CD ballot comments which WG14 considered during the ballot comment resolution meetings in Jan and Feb 2023, and this updates our implementation based on the decisions reached. Those decisions were (paraphrased for brevity):

US 9-034 (REJECTED) -- allow `(void *)nullptr` to be a null pointer constant
US 10-035 (ACCEPTED) -- accept the following code, as in C++: `void func(nullptr_t); func(0);`
US 22-058 (REJECTED) -- accept the following code, as in C++: `nullptr_t val; (void)(1 ? val : 0); (void)(1 ? nullptr : 0);`
US 23-062 (REJECTED) -- reject the following code, as in C++: `nullptr_t val; bool b1 = val; bool b2 = nullptr;`
US 24-061 (ACCEPTED) -- accept the following code, as in C++: `nullptr_t val; val = 0;`
US 21-068 (ACCEPTED) -- accept the following code, as in C++: `(nullptr_t)nullptr;`
GB-071 (ACCEPTED) -- accept the following code, as in C++: `nullptr_t val; (void)(val == nullptr);`

This patch updates the implementation as appropriate, but is primarily focused around US 10-035, US 24-061, and US 23-062 in terms of functional changes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148800

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Sema/SemaExpr.cpp
  clang/test/C/C2x/n3042.c
  clang/test/Sema/nullptr.c
  clang/www/c_status.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148800.515308.patch
Type: text/x-patch
Size: 9660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230420/40759014/attachment.bin>


More information about the cfe-commits mailing list