diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-08-29 13:47:15 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2024-09-20 23:48:27 +0100 |
commit | a001d515059ba4647169f8c17967d08bbe41cb7a (patch) | |
tree | a5c8e304d2ea5669d9a5eadd0aa2149f90a47583 /gcc/fortran/error.cc | |
parent | 82309222300acf68e345b32155df21e1b876144e (diff) | |
download | gcc-a001d515059ba4647169f8c17967d08bbe41cb7a.zip gcc-a001d515059ba4647169f8c17967d08bbe41cb7a.tar.gz gcc-a001d515059ba4647169f8c17967d08bbe41cb7a.tar.bz2 |
libstdc++: Avoid forming T* in unique_ptr(auto_ptr<U>&&) constraints [PR116529]
PR 116529 shows that std::unique_ptr<X&, D> is currently unusable
because the constructor taking std::auto_ptr (which is a non-standard
extension since C++17) tries to form the invalid type X&* during
overload resolution. We can use the `pointer` type in the constructor
constraints, instead of trying to form an invalid type. The
std::auto_ptr constructor can never actually match for the case where
element_type is a reference, so we just need it to produce a
substitution failure instead of being ill-formed.
LWG 4144 might make std::unique_ptr<X&, D> ill-formed, which would
invalidate this new test. We would have to remove this test in that
case. Using `pointer` in the constructor from std::auto_ptr would not be
needed to support the std::unique_ptr<X&, D> case, but would not cause
any harm either.
libstdc++-v3/ChangeLog:
PR libstdc++/116529
* include/bits/unique_ptr.h (unique_ptr(auto_ptr<U>&&)):
Use pointer instead of T*.
* testsuite/20_util/unique_ptr/creation/116529.cc: New test.
Diffstat (limited to 'gcc/fortran/error.cc')
0 files changed, 0 insertions, 0 deletions