diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-08-03 09:05:05 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-08-03 09:05:05 -0400 |
commit | 8256d5c0097dff00f9bdf9ee0c9d53bd7cec2802 (patch) | |
tree | d59e68a9a9566777a5c4295ece90d7c1c753b69d /libstdc++-v3/testsuite | |
parent | db9834aead7629c3f8d640fa546fdc84780c354a (diff) | |
download | gcc-8256d5c0097dff00f9bdf9ee0c9d53bd7cec2802.zip gcc-8256d5c0097dff00f9bdf9ee0c9d53bd7cec2802.tar.gz gcc-8256d5c0097dff00f9bdf9ee0c9d53bd7cec2802.tar.bz2 |
libstdc++: use concrete return type for std::forward_like
Inspired by https://github.com/llvm/llvm-project/issues/101614 this
inverts the relationship between forward_like and __like_t so that
forward_like is defined in terms of __like_t and with a concrete return
type. __like_t in turn is defined via partial specializations that
pattern match on the const- and reference-ness of T.
This turns out to be more SFINAE friendly and significantly cheaper
to compile than the previous implementation.
libstdc++-v3/ChangeLog:
* include/bits/move.h (__like_impl): New metafunction.
(__like_t): Redefine in terms of __like_impl.
(forward_like): Redefine in terms of __like_t.
* testsuite/20_util/forward_like/2_neg.cc: Don't expect
error outside the immediate context anymore.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/20_util/forward_like/2_neg.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libstdc++-v3/testsuite/20_util/forward_like/2_neg.cc b/libstdc++-v3/testsuite/20_util/forward_like/2_neg.cc index ff835af..5dafa41 100644 --- a/libstdc++-v3/testsuite/20_util/forward_like/2_neg.cc +++ b/libstdc++-v3/testsuite/20_util/forward_like/2_neg.cc @@ -2,9 +2,7 @@ #include <utility> -auto x1 = std::forward_like<void>(1); // { dg-error "here" } +auto x1 = std::forward_like<void>(1); // { dg-error "no match" } // { dg-error "forming reference to void" "" { target *-*-* } 0 } -auto x2 = std::forward_like<void()const>(1); // { dg-error "here" } +auto x2 = std::forward_like<void()const>(1); // { dg-error "no match" } // { dg-error "forming reference to qualified function" "" { target *-*-* } 0 } - -// { dg-prune-output "inconsistent deduction for auto return type" } // PR111484 |