[Boost-bugs] [Boost C++ Libraries] #12680: Inheriting constructors from Boost.Variant should be possible

Subject: [Boost-bugs] [Boost C++ Libraries] #12680: Inheriting constructors from Boost.Variant should be possible
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-12-12 10:14:48


#12680: Inheriting constructors from Boost.Variant should be possible
------------------------------+---------------------
 Reporter: djh | Owner: ebf
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: variant
  Version: Boost 1.62.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 Suppose users want a strong typedef for their sumtypes. Instead of
 creating a weak type alias for a boost::variant the user should be able to
 inherit from the variant inheriting its constructors, too.

 {{{
 using TreeBase = boost::variant<Leaf, boost::recursive_wrapper<Node>>;

 struct Tree : TreeBase {
   using TreeBase::TreeBase;

   // ...
 };
 }}}

 Here is the full small self-contained example

 https://gist.github.com/daniel-j-h/12c8b7f1c59b5a76c7e75dab38eb06fe#file-
 crash-cc

 GCC crashing on this is ticketed upstream

 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78767


 Creating a new type for this use-case provides the user with type safety
 and should be the recommended way of using variant in any non-trivial
 code. Unfortunately, inheriting from Boost.Variant is not possible at the
 moment. The code example above does not compile.

 In the Boost IRC channel Agustín Bergé told me this might be related to
 inheriting constructors with default arguments and that there are quirks
 related to SFINAE before C++17.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12680>
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