[libcxx-commits] [PATCH] D93153: [libc++] Consistently replace `::new(__p) T` with `::new ((void*)__p) T`. NFCI

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 11 18:08:15 PST 2020


Quuxplusone created this revision.
Quuxplusone added a reviewer: ldionne.
Quuxplusone added a project: libc++.
Herald added a subscriber: mgrang.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Everywhere, normalize the whitespace to `::new (EXPR) T`.
Everywhere, normalize the spelling of the cast to `(void*)EXPR`.

Without the cast to `(void*)`, the expression triggers ADL on GCC.
(I think this is a GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98249)
Even if it doesn't trigger ADL, it still seems incorrect to use any argument that's not exactly `(void*)` because that opens the possibility of overload resolution picking a user-defined overload of `operator new`, which would be wrong.

(I admit this is nitpicky and code-churny, but it's also cleanup. I'm particularly interested to see if buildkite will tell me exactly why `__voidify` was needed for the constexpr `construct_at` stuff; that's the one slightly scary change hiding in this PR.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93153

Files:
  libcxx/include/__debug
  libcxx/include/__functional_03
  libcxx/include/algorithm
  libcxx/include/functional
  libcxx/include/future
  libcxx/include/memory
  libcxx/include/optional
  libcxx/include/valarray
  libcxx/test/std/algorithms/robust_against_adl_on_new.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93153.311347.patch
Type: text/x-patch
Size: 34399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201212/7b5bd0a5/attachment-0001.bin>


More information about the libcxx-commits mailing list