[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.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 16 09:22:44 PDT 2019
ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: dexonsmith.
Let's not block this because I have questions about the warning implemented in Clang. Richard, you can ship this. Thanks for the fix and sorry for the delay.
================
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);
----------------
rsmith wrote:
> 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?
My question was: why don't we warn in the location where the user says `std::declval<volatile Foo>()`, and only there?
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