Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-01-20 08:01:46


On Mon, 19 Jan 2004 13:44:02 -0700, Jonathan Turkanis wrote:
[...]

#include "move_ptr.hpp" // file defined in your post
using namespace boost;

int main()
{
  move_ptr<int> pi = move_ptr<int>(new int);
}

compiles fine under MSVC71 without "/Za" option (Disable Language
Extensions). However with this option on, it throws rather nasty
compilation error. Unfortunatelly, it's rather useful option - it makes
MSVC71 more standard compliant (to the degree that Windows API headers
cannot be accepted by compiler, but it's different issue. These headers
are not always necessary).

The very same simple program compiles fine under MING (GCC 3.3.1) with
and without "-pedantic -ansi" flag. I wonder how it would look like
under GCC 3.3.2, GCC 3.4.0 and Comeau.

B.

PS here's error message from MSVC71, when compiled with /Za option:

C:\DATA\USERS\bronislaw\My Documents\msys\T197.cpp(7) : error C2248:
'boost::move_ptr<T>::__ctor' : cannot access private member declared in
class 'boost::move_ptr<T>'
        with
        [
            T=int
        ]
        and
        [
            T=int
        ]
        and
        [
            T=int
        ]
        c:\DATA\USERS\bronislaw\My Documents\msys\move_ptr.hpp(151) :
see declaration of 'boost::move_ptr<T>::__ctor'
        with
        [
            T=int
        ]
        and
        [
            T=int
        ]
        while checking that elided copy-constructor
'boost::move_ptr<T>::move_ptr(boost::move_ptr<T> &)' is callable
        with
        [
            T=int
        ]
        c:\DATA\USERS\bronislaw\My Documents\msys\move_ptr.hpp(151) :
see declaration of 'boost::move_ptr<T>::__ctor'
        with
        [
            T=int
        ]
        and
        [
            T=int
        ]
        when converting from 'boost::move_ptr<T>' to 'const
boost::move_ptr<T> &'
        with
        [
            T=int
        ]
        and
        [
            T=int
        ]
        C:\DATA\USERS\bronislaw\My Documents\msys\T197.cpp(7) : see
reference to class template instantiation
'boost::move_ptr<T>::cant_move_from_const<U>' being compiled
        with
        [
            T=int,
            U=boost::move_ptr<int>
        ]
        C:\DATA\USERS\bronislaw\My Documents\msys\T197.cpp(7) : see
reference to class template instantiation
'boost::move_ptr<T>::cant_move_from_const<U>' being compiled
        with
        [
            T=int,
            U=int *
        ]
C:\DATA\USERS\bronislaw\My Documents\msys\T197.cpp(7) : error C2440:
'argument' : cannot convert from 'boost::move_ptr<T>' to
'boost::move_ptr<T> &'
        with
        [
            T=int
        ]
        and
        [
            T=int
        ]
        A reference that is not to 'const' cannot be bound to a
non-lvalue
        while checking that elided copy-constructor
'boost::move_ptr<T>::move_ptr(boost::move_ptr<T> &)' is callable
        with
        [
            T=int
        ]
        c:\DATA\USERS\bronislaw\My Documents\msys\move_ptr.hpp(151) :
see declaration of 'boost::move_ptr<T>::__ctor'
        with
        [
            T=int
        ]
        and
        [
            T=int
        ]
        when converting from 'boost::move_ptr<T>' to 'const
boost::move_ptr<T> &'
        with
        [
            T=int
        ]
        and
        [
            T=int
        ]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk