[Boost-bugs] [Boost C++ Libraries] #11751: variant of non-const references fails equality compare

Subject: [Boost-bugs] [Boost C++ Libraries] #11751: variant of non-const references fails equality compare
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-10-23 18:59:31


#11751: variant of non-const references fails equality compare
------------------------+------------------------------
 Reporter: nikkoara@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.59.0
 Severity: Problem | Keywords: variant
------------------------+------------------------------
 The following aborts:

 {{{#!c++
 #include <boost/variant.hpp>

 using variant_type = boost::variant< int& >;

 int main () {
     int a, b;

     variant_type v (a), u (b);
     v == u;

     return 0;
 }
 }}}

 Compile and run:

 {{{
 $ g++ -std=c++14 -I/opt/boost/default/include t.cpp && ./a.out
 a.out:
 /opt/boost/default/include/boost/variant/detail/forced_return.hpp:39: T
 boost::detail::variant::forced_return() [with T = const int&]: Assertion
 `false' failed.
 Aborted (core dumped)
 }}}

 It seems that the cause is the instantiation of known_get for const T at
 line 905 in variant.hpp (1.59.0).

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