https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126120

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-07-06

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to winapiadmin from comment #0)
> Created attachment 64943 [details]
> The reproduce code, compiled with C++17

Strictly speaking, there are no Constraints in the C++17 standard:

Requires: Construction of d and a deleter of type D initialized with
std::move(d) shall not throw exceptions. The expression d(p) shall have
well-defined behavior and shall not throw exceptions.

That was replaced with Constraints: for C++20, but we do intend to implement
the Constraints: all the way back to C++11.

We do constrain the std::shared_ptr constructors:

      template<typename _Yp, typename _Deleter,
               typename = _Constructible<_Yp*, _Deleter>>
        shared_ptr(_Yp* __p, _Deleter __d)
        : __shared_ptr<_Tp>(__p, std::move(__d)) { }

But that _Constructible check only checks if the std::__shared_ptr base class
is constructible from those arguments, and the base constructor is *not*
constrained on the deleter being invocable.

So we need to either adjust the constrains on the derived class, or add the
correct constraints on the base class.

Reply via email to