Modify

Ticket #12203 (closed Bugs: fixed)

Opened 8 months ago

Last modified 3 months ago

boost::optional<optional<T>&> broken in 1.61.0

Reported by: benzejaa@… Owned by: fcacciola
Milestone: Boost 1.63.0 Component: optional
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

With the new specialization for boost::optional<T&>, there's one use case that's broken now...if T is itself an optional, things are broken.

Diving into optional/detail/optional_reference_spec.hpp it looks like there's some boost::enable_if statements disabling this functionality. Presumably these statements are to differentiate from the copy constructors/assignment above (although I'm not sure why some of the other statements are similarly guarded). However "is_no_optional" is too broad of a guard.

Likely something like !boost::is_same<optional<T&>, typename boost::decay<R>::type> would be a better condition...I'll try it out and update with further info.

Attachments

Change History

comment:1 Changed 8 months ago by anonymous

For posterity, here's a reproducer:

#include<boost/optional.hpp>

int main()
{
   boost::optional<int> x;
   boost::optional<boost::optional<int>&> y(x); //compile error
   return 0;
}

comment:2 Changed 8 months ago by benzejaa@…

comment:3 Changed 8 months ago by johnmaddock

  • Owner set to fcacciola
  • Component changed from None to optional

comment:4 Changed 8 months ago by benzejaa@…

Whoops, that patch has a minor typo...hold on, let me generate a fixed one

comment:5 Changed 8 months ago by benzejaa@…

Okay same pull request, fixed typo (apparently github lets me just stealthy push --force behind the scenes and updates my pull request automatically...nice!)

comment:6 Changed 3 months ago by akrzemi1

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from To Be Determined to Boost 1.63.0
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.