Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#11088 closed Bugs (duplicate)

Converting assignment operator is too generous

Reported by: anonymous Owned by: Fernando Cacciola
Milestone: To Be Determined Component: optional
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

This has been reported by Karol Nowacki. The following program compiles although it shoudl not.

#include <boost/optional.hpp>

enum E1 {e1};
enum E2 {e2};

int main()
{
  boost::optional<E2> o2(e2);
  boost::optional<E1> o1;
  o1 = o2; // SHOULD NOT WORK
}

It should not compile given that the following do not compile:

E1 v1 = e2; // FAILS
E1 v1_;
v1_ = e2;   // FAILS

Change History (2)

comment:1 by akrzemi1, 8 years ago

Resolution: duplicate
Status: newclosed

comment:2 by akrzemi1, 8 years ago

Duplicate of #11087

Note: See TracTickets for help on using tickets.