[libcxx-commits] [PATCH] D119894: [libc++] Add `explicit` to a bunch of private detail ctors.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 15 14:39:29 PST 2022


Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, Mordante, libc++.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

Notably, `__debug_less`'s one-argument ctor remains non-explicit because we rely on that implicit conversion.

This has been on my to-do list for a while, just for general code cleanliness. This was //not// done with any mechanical assistance (e.g. a compiler warning for non-explicit ctors); it was just me knowing about certain ctors for a long time (e.g. `__bit_reference`), and then brainstorming or randomly happening across some others.

Oddly, //only// Clang (not GCC or MSVC) thinks that this change has beneficial effects on overload resolution. I'm not sure who's correct here, but, C++ being C++, I would guess that GCC and MSVC are correct and Clang is wrong. https://godbolt.org/z/K76sr5MG9


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119894

Files:
  libcxx/include/__bit_reference
  libcxx/include/__debug
  libcxx/include/__iterator/common_iterator.h
  libcxx/include/__iterator/istreambuf_iterator.h
  libcxx/include/__memory/compressed_pair.h
  libcxx/include/iomanip

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119894.409054.patch
Type: text/x-patch
Size: 8322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220215/4a0b5559/attachment-0001.bin>


More information about the libcxx-commits mailing list