Re: [PATCH] libstdc++: Prevent dangling references in std::unique_ptr::operator*

2025-03-12 Thread Jonathan Wakely
On Wed, 12 Mar 2025 at 07:38, Tomasz Kaminski wrote: > > > > On Tue, Mar 11, 2025 at 10:26 PM Jonathan Wakely wrote: >> >> LWG 4148 (approved in Wrocław, November 2024) makes it ill-formed to >> dereference a std::unique_ptr if that would return a dangling reference. >> >> That can happen with a

Re: [PATCH] libstdc++: Prevent dangling references in std::unique_ptr::operator*

2025-03-12 Thread Tomasz Kaminski
On Tue, Mar 11, 2025 at 10:26 PM Jonathan Wakely wrote: > LWG 4148 (approved in Wrocław, November 2024) makes it ill-formed to > dereference a std::unique_ptr if that would return a dangling reference. > > That can happen with a custom pointer type and a const-qualified > element_type, such that

[PATCH] libstdc++: Prevent dangling references in std::unique_ptr::operator*

2025-03-11 Thread Jonathan Wakely
LWG 4148 (approved in Wrocław, November 2024) makes it ill-formed to dereference a std::unique_ptr if that would return a dangling reference. That can happen with a custom pointer type and a const-qualified element_type, such that std::add_lvalue_reference_t is a reference-to-const that could bind