|
Boost Users : |
Subject: Re: [Boost-users] [Variant] Assertion fails at variant/detail/visitation_impl.hpp:207
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2015-01-30 13:23:48
2015-01-30 14:08 GMT+03:00 Attila Rajmund Nohl <attila.r.nohl_at_[hidden]>:
> Hello!
>
> I'm using boost-1.55 on Linux. When I run a specific testcase, I get
> an abort at line 207 in the visitation_impl.hpp file. The comment says
> that "should never be here at runtime". Unfortunately I don't really
> understand under what circumstances could runtime end up here - could
> someone explain how? The variant has a recursive element, i.e. looks
> something like this:
>
> struct Resp;
>
> struct SR {
> }
>
> struct AR {
> std::vector<Resp> resp;
> }
>
> typedef variant< SR, recursive_wrapper<AR> > RMType;
>
> struct Resp {
> RMType rm;
> }
>
Could you please provide a full source code reproducing the error.
Otherwise it's extremely hard to examine the issue.
> "should never be here at runtime"
It means that internal state of variant was broken and the variant variable
does not know any more what type does it hold. Usually this means that
something really wrong was done with the variant variable:
# 1
boost::variant<int, std::string, float> v;
std::memset(&v, 120, sizeof(v)); // corrupting data
boost::get<int>(v); // assertion "should never be here at runtime"
# 2
boost::variant<int, std::string, float>* v; // uninitialized pointer
boost::get<int>(*v); // assertion "should never be here at runtime"
-- Best regards, Antony Polukhin
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net