diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-01-19 12:28:30 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2024-01-19 19:12:38 +0000 |
commit | 502a3c03e40e8920afb734c077b045f6c5efd087 (patch) | |
tree | 92e6cbf75c07350cd03435aac46a896fdcdf2c30 /libstdc++-v3/include/std/tuple | |
parent | f1e5bf0d83ee4da81b6317c6d7f1278fe7eaa5a0 (diff) | |
download | gcc-502a3c03e40e8920afb734c077b045f6c5efd087.zip gcc-502a3c03e40e8920afb734c077b045f6c5efd087.tar.gz gcc-502a3c03e40e8920afb734c077b045f6c5efd087.tar.bz2 |
libstdc++: Fix P2255R2 dangling checks for std::tuple in C++17 [PR108822]
I accidentally used && in a fold-expression instead of || which meant
that in C++17 the tuple(UElements&&...) constructor only failed its
debug assertion if all tuple elements were dangling references. Some
missing tests (noted as "TODO") meant this wasn't tested.
This fixes the fold expression and adds the missing tests.
libstdc++-v3/ChangeLog:
PR libstdc++/108822
* include/std/tuple (__glibcxx_no_dangling_refs) [C++17]: Fix
wrong fold-operator.
* testsuite/20_util/tuple/dangling_ref.cc: Check tuples with one
element and three elements. Check allocator-extended
constructors.
Diffstat (limited to 'libstdc++-v3/include/std/tuple')
-rw-r--r-- | libstdc++-v3/include/std/tuple | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 7a045b3..be92f1e 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -1299,7 +1299,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Error if construction from U... would create a dangling ref. # if __cpp_fold_expressions # define __glibcxx_dangling_refs(U) \ - (__reference_constructs_from_temporary(_Elements, U) && ...) + (__reference_constructs_from_temporary(_Elements, U) || ...) # else # define __glibcxx_dangling_refs(U) \ __or_<__bool_constant<__reference_constructs_from_temporary(_Elements, U) \ |