Modify

Opened 3 years ago

Last modified 3 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;
}

}

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by John Maddock

Component: Nonesmart_ptr
Owner: set to Peter Dimov

comment:2 Changed 3 years ago by Peter Dimov

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Peter Dimov.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.