[Boost-bugs] [Boost C++ Libraries] #12563: Assigning to boost::optional<std::tuple from std::tuple fails to compile using c++14 and libc++.

Subject: [Boost-bugs] [Boost C++ Libraries] #12563: Assigning to boost::optional<std::tuple from std::tuple fails to compile using c++14 and libc++.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-10-27 22:27:36


#12563: Assigning to boost::optional<std::tuple from std::tuple fails to compile
using c++14 and libc++.
--------------------------------------+------------------------
 Reporter: Andrew King <eurokang@…> | Owner: fcacciola
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: optional
  Version: Boost 1.62.0 | Severity: Regression
 Keywords: |
--------------------------------------+------------------------
 {{{
 #include <boost/optional.hpp>

 #include <tuple>

 using Tup = std::tuple<boost::optional<int>>;
 Tup x;

 boost::optional<Tup> y = x;
 }}}

 when compiled with:
 clang++-3.7 -std=c++14 -stdlib=libc++ temp.cpp
 fails to compile:
 {{{
 error: no matching member function for call to
       'construct'
         this->construct( boost::move(rhs.get()) );
         ~~~~~~^~~~~~~~~
 /usr/include/c++/v1/tuple:220:15: note: in instantiation of function
 template specialization
       'boost::optional<int>::optional<std::__1::tuple<boost::optional<int>
> >' requested here
             : value(_VSTD::forward<_Tp>(__t))
               ^
 /path/boost/1.62.0a-src/boost/boost/optional/optional.hpp:348:10: note:
 candidate function not viable: no known
       conversion from 'typename
 ::boost::move_detail::remove_reference<tuple<optional<int> > &>::type'
 (aka 'std::__1::tuple<boost::optional<int> >') to
       'const int' for 1st argument
     void construct ( argument_type val )
          ^
 /path/boost/1.62.0a-src/boost/boost/optional/optional.hpp:355:10: note:
 candidate function not viable: no known
       conversion from 'typename
 ::boost::move_detail::remove_reference<tuple<optional<int> > &>::type'
 (aka 'std::__1::tuple<boost::optional<int> >') to 'int'
       for 1st argument
     void construct ( rval_reference_type val )
          ^
 /path/boost/1.62.0a-src/boost/boost/optional/optional.hpp:367:10: note:
 candidate function [with Args = <>] not viable:
       no known conversion from 'typename
 ::boost::move_detail::remove_reference<tuple<optional<int> > &>::type'
 (aka 'std::__1::tuple<boost::optional<int> >')
       to 'boost::optional_ns::in_place_init_t' for 1st argument
     void construct ( in_place_init_t, Args&&... args )
          ^
 /path/boost/1.62.0a-src/boost/boost/optional/optional.hpp:544:10: note:
 candidate function template not viable: requires
       2 arguments, but 1 was provided
     void construct ( Expr&& factory, in_place_factory_base const* )
          ^
 /path/boost/1.62.0a-src/boost/boost/optional/optional.hpp:552:10: note:
 candidate function template not viable: requires
       2 arguments, but 1 was provided
     void construct ( Expr&& factory, typed_in_place_factory_base const* )
          ^
 /path/boost/1.62.0a-src/boost/boost/optional/optional.hpp:614:10: note:
 candidate function template not viable: requires
       2 arguments, but 1 was provided
     void construct ( Expr&& expr, void const* )

 }}}

 Compiling with -std=c++11 and -stdlib=libc++ compiles fine.
 Compiling with -std=c++14 and -stdlib=libstdc++ compiles fine.
 Using std::experimental::optional instead of boost::optional compiles
 fine.
 Using boost::tuple instead of libc++ std::tuple compiles fine.

 So it seems to only be libc++ libc++ tuple with boost::optional and c++14.
 I am not sure the bug is actually a boost::optional bug, (it may be libc++
 or clang) so if this is incorrect please let me know.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12563>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC