[libcxx-commits] [PATCH] D103753: [libc++] [P0619] Add _LIBCPP_ABI_NO_BINDER_BASES and remove binder typedefs in C++20.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 11 07:57:38 PDT 2021
Quuxplusone marked 6 inline comments as done.
Quuxplusone added inline comments.
================
Comment at: libcxx/include/functional:555
+#if defined(_LIBCPP_CXX03_LANG) || !defined(_LIBCPP_ABI_NO_BINDER_BASES)
+ : binary_function<_Tp, _Tp, _Tp>
+#endif
----------------
ldionne wrote:
> What Standard removed those bases? Is it C++11 or C++14?
>
> Using `_LIBCPP_CXX03_LANG` doesn't look right to me. That macro only means that the compiler supports C++03 language feature, it is not related to the standard version that libc++ tries to implement (which is always C++11 or above).
These bases are present in C++03 and removed in C++11.
I was looking at other things new-in-'11 and saw them guarded by `_LIBCPP_CXX03_LANG`, so I copied that here; but that was entirely cargo-cult. I'm happy to remove the guard here, i.e. make it just
```
#if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
```
Will do.
@ldionne, my understanding is that these days, `_LIBCPP_CXX03_LANG` mode is allowed to assume that the compiler supports `Foo&&` and `decltype` syntaxes as extensions (but maybe not `initializer_list` or `Args...`). Would you be interested in a PR to remove the guards around things like https://github.com/llvm/llvm-project/blob/2d0f1fa/libcxx/include/vector#L703-L712 ?
================
Comment at: libcxx/include/functional:561
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
+ typedef _Tp result_type;
+ typedef _Tp first_argument_type;
----------------
ldionne wrote:
> Those typedefs are deprecated in C++17. I assume you did not mark them as deprecated since if someone is opting into them, they are probably not wanting to fight agains the deprecation warning?
No, that was me not realizing they were deprecated in C++17. I'll add
```
_LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
```
etc., matching how it's done in "__memory/allocator.h".
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103753/new/
https://reviews.llvm.org/D103753
More information about the libcxx-commits
mailing list