Opened 2 years ago

Closed 16 months ago

#11751 closed Bugs (fixed)

variant of non-const references fails equality compare

Reported by: nikkoara@… Owned by: Antony Polukhin
Milestone: Boost 1.62.0 Component: variant
Version: Boost 1.59.0 Severity: Problem
Keywords: variant Cc:


The following aborts:

#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).

Attachments (0)

Change History (4)

comment:1 Changed 2 years ago by anonymous

Component: Nonevariant
Owner: set to ebf

comment:2 Changed 21 months ago by Antony Polukhin

Milestone: To Be DeterminedBoost 1.62.0
Owner: changed from ebf to Antony Polukhin
Status: newassigned

comment:3 Changed 21 months ago by Antony Polukhin

Fixed in 082732aa develop, will be merged to master as soon as the tests will cycle.

comment:4 Changed 16 months ago by Antony Polukhin

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Antony Polukhin.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.