[Bug 276187] devel/cpprestsdk: json.h breaks with the FreeBSD std::unique_ptr

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 07 Jan 2024 21:26:44 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276187

            Bug ID: 276187
           Summary: devel/cpprestsdk: json.h breaks with the FreeBSD
                    std::unique_ptr
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: sigsegv@radiotube.org

Created attachment 247517
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=247517&action=edit
Patch files to de-inline the failing constructor and destructor

A simple #include <cpprestsdk/json.h> fails with errors like this:

In file included from /usr/include/c++/v1/iostream:43:
In file included from /usr/include/c++/v1/ios:221:
In file included from /usr/include/c++/v1/__locale:18:
In file included from /usr/include/c++/v1/mutex:191:
In file included from /usr/include/c++/v1/__memory/shared_ptr.h:31:
/usr/include/c++/v1/__memory/unique_ptr.h:63:19: error: invalid application of
'sizeof' to an incomplete type 'web::json::details::_Value'
    static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
                  ^~~~~~~~~~~
/usr/include/c++/v1/__memory/unique_ptr.h:297:7: note: in instantiation of
member function 'std::default_delete<web::json::details::_Value>::operator()'
requested here
      __ptr_.second()(__tmp);
      ^
/usr/include/c++/v1/__memory/unique_ptr.h:263:75: note: in instantiation of
member function 'std::unique_ptr<web::json::details::_Value>::reset' requested
here
  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() {
reset(); }
                                                                          ^
/usr/local/include/cpprest/json.h:716:14: note: in instantiation of member
function 'std::unique_ptr<web::json::details::_Value>::~unique_ptr' requested
here
    explicit value(std::unique_ptr<details::_Value> v) : m_value(std::move(v))
             ^
/usr/local/include/cpprest/json.h:35:7: note: forward declaration of
'web::json::details::_Value'
class _Value;
      ^
1 error generated.

Suggested patch included. De-inlining the constructor and destructor makes the
sizeof(_Value) available to std::unique_ptr.

-- 
You are receiving this mail because:
You are the assignee for the bug.