Boost logo

Boost :

From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-09-19 09:14:53


Hi,

Could you see the following tests:

#include <boost/optional/optional.hpp>
#include <cassert>

int main()
{
    {
        int const i = 10;
        boost::optional<int const &> o(i);
        assert(*o == 10);
        assert(&*o == &i); // ok
    }
    {
        int const i = 10;
        boost::optional<int const &> o = i; // copy-initialization
        assert(*o == 10);
        assert(&*o == &i); // failed on gcc3.4 and 4.1.
    }
}

For some reason, msvc passes this.
Is this a bug, or copy-initialization is prohibited?

Regards,

-- 
Shunsuke Sogame

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