aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-06-24 12:56:20 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-06-24 14:04:02 +0100
commit17bc3848e065c0980523e1a1592f2f03b24b4f1c (patch)
tree0149b4f6b118bc81b9423c4f634c74b678f7d430 /gcc
parenta21dc9d1529b8a8071e36b22b6e8492fc2ce7d5a (diff)
downloadgcc-17bc3848e065c0980523e1a1592f2f03b24b4f1c.zip
gcc-17bc3848e065c0980523e1a1592f2f03b24b4f1c.tar.gz
gcc-17bc3848e065c0980523e1a1592f2f03b24b4f1c.tar.bz2
libstdc++: Implement LWG 2762 for std::unique_ptr::operator*
The LWG issue proposes to add a conditional noexcept-specifier to std::unique_ptr's dereference operator. The issue is currently in Tentatively Ready status, but even if it isn't voted into the draft, we can do it as a conforming extensions. This commit also adds a similar noexcept-specifier to operator[] for the unique_ptr<T[], D> partial specialization. Also ensure that all dereference operators for shared_ptr are noexcept, and adds tests for the std::optional accessors modified by the issue, which were already noexcept in our implementation. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/shared_ptr_base.h (__shared_ptr_access::operator[]): Add noexcept. * include/bits/unique_ptr.h (unique_ptr::operator*): Add conditional noexcept as per LWG 2762. * testsuite/20_util/shared_ptr/observers/array.cc: Check that dereferencing cannot throw. * testsuite/20_util/shared_ptr/observers/get.cc: Likewise. * testsuite/20_util/optional/observers/lwg2762.cc: New test. * testsuite/20_util/unique_ptr/lwg2762.cc: New test.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions