[libcxx-commits] [PATCH] D104682: [libc++] Enable `explicit` conversion operators, even in C++03 mode.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 21 19:32:09 PDT 2021


Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, EricWF, mclow.lists, 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++.

This is a "pivot" of the third part of D104310 <https://reviews.llvm.org/D104310>: instead of doing all of iostreams at once, let's do everyone's explicit conversion operators at once!

  C++03 didn't support `explicit` conversion operators;
  but Clang's C++03 mode does, as an extension, so we can use it.
  This lets us make the conversion explicit in `std::function` (even in '03),
  and remove some silly metaprogramming in `std::basic_ios`.
  
  Drive-by improvements to the tests for these operators, in addition
  to making sure all these tests also run in `c++03` mode.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104682

Files:
  libcxx/include/__config
  libcxx/include/__functional_03
  libcxx/include/__memory/shared_ptr.h
  libcxx/include/__memory/unique_ptr.h
  libcxx/include/__mutex_base
  libcxx/include/exception
  libcxx/include/functional
  libcxx/include/ios
  libcxx/include/istream
  libcxx/include/ostream
  libcxx/include/system_error
  libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.compile.fail.cpp
  libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.pass.cpp
  libcxx/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp
  libcxx/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp
  libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp
  libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp
  libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/op_bool.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104682.353529.patch
Type: text/x-patch
Size: 15663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210622/a5090452/attachment-0001.bin>


More information about the libcxx-commits mailing list