Opened 7 years ago

Last modified 7 years ago

#11270 new Bugs

bost::shared_ptr && boost::optional fail to compile in single if statement

Reported by: Vladimir Venediktov Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.58.0 Severity: Problem
Keywords: boost::shared_ptr && boost::optional Cc: Sun, Studio, 12.4, -std=c++11

Description

/*
using sun 12.4 with std=c++11 does not compile shared_ptr and optional in single if statement , example : if ( ptr && opt_value )
giving following message :   Error: The operation "boost::shared_ptr<int> && boost::optional<int>" is illegal

boost version : 1.58

compilation command :
/appl/toolbox/solarisstudio12.4/bin/CC -std=c++11  -I/home/vvenedik/C++/boost_1_58_0 -c main_5.cpp -o main_5.o
*/

#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <iostream>


int main() {

boost::shared_ptr<int> ptr(new int) ;

boost::optional<int> opt_int;

opt_int = 5;


if ( ptr && opt_int ) {
    std::cout << "compiled and ran OK" << std::endl;
}

}

Change History (2)

comment:1 by John Maddock, 7 years ago

Component: Nonesmart_ptr
Owner: set to Peter Dimov

comment:2 by Peter Dimov, 7 years ago

Does ptr && ptr work? opt_int && opt_int?

Note: See TracTickets for help on using tickets.