Opened 14 years ago

Closed 14 years ago

#2277 closed Bugs (fixed)

Invalid assignment void* to iovec::iov_base on the Solaris

Reported by: Simon Atanasyan <atanasyan@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

On the Solaris following test case cannot be compiled by Sun C++.

% cat test.cc
#include <boost/asio.hpp>
int main()
{
    return 0;
};
% CC -V -c -library=stlport4 -I$BOOST test.cc
CC: Sun C++ 5.9 SunOS_sparc Patch 124863-06 2008/07/08
$BOOST/boost/asio/detail/socket_ops.hpp", line 218: Error: Cannot assign void* to char*.
$BOOST/boost/asio/detail/socket_ops.hpp", line 229: Error: Cannot assign void* to char*.
$BOOST/boost/asio/detail/descriptor_ops.hpp", line 66: Error: Cannot assign void* to char*.
$BOOST/boost/asio/detail/descriptor_ops.hpp", line 72: Error: Cannot assign void* to char*.

The problem exists in the 1.35, 1.36 and trunk.

On the Solaris while code compiled by Sun C++ iovec::iov_base field has type caddr_t, which is a typedef, usually for char*. So it is impossible to assign void* to it without explicit cast.

Suggested patch is attached.

Attachments (1)

asio_sunpro_solaris.patch (1.8 KB ) - added by Simon Atanasyan <atanasyan@…> 14 years ago.
Suggested patch

Download all attachments as: .zip

Change History (2)

by Simon Atanasyan <atanasyan@…>, 14 years ago

Attachment: asio_sunpro_solaris.patch added

Suggested patch

comment:1 by chris_kohlhoff, 14 years ago

Resolution: fixed
Status: newclosed

Should have been fixed by changeset #48525. (Which was purely coincidentally checked in on the same day this item was raised!)

However, the intention was that _XOPEN_SOURCE should be defined when building on Solaris. In that case, iov_base is void* as per POSIX specification and older versions of boost.asio work just fine.

Note: See TracTickets for help on using tickets.