[libcxx-commits] [PATCH] D68879: P1152R4: Fix deprecation warnings in libc++ testsuite and in uses of is_invocable that would internally conjure up a deprecated function type.

Richard Smith - zygoloid via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 11 17:56:06 PDT 2019


rsmith marked an inline comment as done.
rsmith added inline comments.


================
Comment at: libcxx/include/type_traits:1123
+// Suppress deprecation notice for volatile-qualified return type.
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Tp> _Tp&& __declval(int);
----------------
ldionne wrote:
> rsmith wrote:
> > ldionne wrote:
> > > Wait, I don't see any `volatile` qualification here?
> > The volatile comes from `_Tp`, specified indirectly through various callers that internally use `declval`. In particular, the `is_invocable<volatile T>` tests end up here.
> That's what I thought, but isn't that warning broken then? Isn't any template going to produce a warning when instantiated with a `volatile T`? I must be misunderstanding something.
We warn when instantiating the second overload of `__declval` with `_Tp` = `volatile T`, because that causes it to have a volatile-qualified return type, which is deprecated. We don't warn on the first overload, because it doesn't have a volatile-qualified return type regardless of `_Tp`. Does that make more sense?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68879/new/

https://reviews.llvm.org/D68879





More information about the libcxx-commits mailing list