[Bug libstdc++/96416] [DR 3545] to_address() is broken by static_assert in pointer_traits

2023-07-07 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96416

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|10.5|11.3
  Known to fail||10.5.0
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
  Known to work||11.3.0

--- Comment #26 from Richard Biener  ---
Fixed in 11.3.

[Bug libstdc++/96416] [DR 3545] to_address() is broken by static_assert in pointer_traits

2022-06-28 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96416

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|10.4|10.5

--- Comment #25 from Jakub Jelinek  ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

[Bug libstdc++/96416] [DR 3545] to_address() is broken by static_assert in pointer_traits

2021-12-08 Thread whatwasthataddress at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96416

--- Comment #24 from Zach Laine  ---
Sorry for the delay.  I confirmed that this makes my case well-formed with
releases/gcc-11, and that it's ill-formed with GCC 11.2 and GCC 10.x.

[Bug libstdc++/96416] [DR 3545] to_address() is broken by static_assert in pointer_traits

2021-11-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96416

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|10.3|10.4
  Known to work||12.0
 Status|SUSPENDED   |ASSIGNED
  Known to fail||10.3.0, 11.2.0

--- Comment #23 from Jonathan Wakely  ---
Fixed for 11.3 now.

If any of you who hit this bug could test GCC trunk or the gcc-11 branch and
confirm it works for your cases now, that would be much appreciated (there are
no actual testcases here in this bug).

[Bug libstdc++/96416] [DR 3545] to_address() is broken by static_assert in pointer_traits

2021-11-26 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96416

--- Comment #22 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:8d3391d64799d490117ad48432a9ad2cf38b0091

commit r11-9317-g8d3391d64799d490117ad48432a9ad2cf38b0091
Author: Jonathan Wakely 
Date:   Thu Nov 25 23:29:08 2021 +

libstdc++: Make std::pointer_traits SFINAE-friendly [PR96416]

This is a simplified version of r12-5532 for the release branches.  It
still removes the problematic static_assert, but rather than making
std::pointer_traits completely empty when the element_type can't be
deduced, it just disables element_type and pointer_to. Additionally, the
pointer_to member is not completely absent when element_type is cv void,
it just has an unusable signature.

This is sufficient to avoid errors outside the immediate context when
trying to use std::to_address.

libstdc++-v3/ChangeLog:

PR libstdc++/96416
* include/bits/ptr_traits.h (pointer_traits): Remove
static_assert checking for valid element_type.
(pointer_traits::element_type, pointer_traits::pointer_to):
Do not define when element type cannot be deduced.
* testsuite/20_util/pointer_traits/lwg3545.cc: New test.
* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line.
* testsuite/20_util/to_address/lwg3545.cc: New test.

(cherry picked from commit b8018e5c5ec0e9b6948182f13fba47c67b758d8a)

[Bug libstdc++/96416] [DR 3545] to_address() is broken by static_assert in pointer_traits

2021-11-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96416

--- Comment #21 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:b8018e5c5ec0e9b6948182f13fba47c67b758d8a

commit r12-5532-gb8018e5c5ec0e9b6948182f13fba47c67b758d8a
Author: Jonathan Wakely 
Date:   Thu Nov 25 16:49:45 2021 +

libstdc++: Make std::pointer_traits SFINAE-friendly [PR96416]

This implements the resolution I'm proposing for LWG 3545, to avoid hard
errors when using std::to_address for types that make pointer_traits
ill-formed.

Consistent with std::iterator_traits, instantiating std::pointer_traits
for a non-pointer type will be well-formed, but give an empty type with
no member types. This avoids the problematic cases for std::to_address.
Additionally, the pointer_to member is now only declared when the
element type is not cv void (and for C++20, when the function body would
be well-formed). The rebind member was already SFINAE-friendly in our
implementation.

libstdc++-v3/ChangeLog:

PR libstdc++/96416
* include/bits/ptr_traits.h (pointer_traits): Reimplement to be
SFINAE-friendly (LWG 3545).
* testsuite/20_util/pointer_traits/lwg3545.cc: New test.
* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line.
* testsuite/20_util/to_address/lwg3545.cc: New test.

[Bug libstdc++/96416] [DR 3545] to_address() is broken by static_assert in pointer_traits

2021-09-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96416

Jonathan Wakely  changed:

   What|Removed |Added

 Status|RESOLVED|SUSPENDED
Summary|to_address() is broken by   |[DR 3545] to_address() is
   |static_assert in|broken by static_assert in
   |pointer_traits  |pointer_traits
 Resolution|INVALID |---

--- Comment #20 from Jonathan Wakely  ---
Reopening and suspending, until https://wg21.link/lwg3545 is resolved.