Boost logo

Boost Users :

Subject: [Boost-users] [Variant] recursive_wrapper and ambiguous convert_construct()
From: Florian Goujeon (florian.goujeon_at_[hidden])
Date: 2012-04-09 11:48:18


Hello,

I'm modelizing a syntax tree using boost::variant, std::tuple and
std::vector. This syntax tree has a lot of cyclic dependencies, so I have
to use boost::recursive_wrapper along with forward declarations.

I've encountered a case that my compiler (GCC 4.7) refuses to build.
Here is the source code: http://pastebin.com/3a5xU06x (it's pretty short)
Here is the compilation error message: http://pastebin.com/Zpa3TCp2

(Of course, reordering the declarations would solve the problem in this
example, but it's not the point. This is a constraint I can't get rid of
in my whole project.)

The compiler complains about an ambiguous call of convert_construct() in
Boost's source code, where a comment says:
     NOTE TO USER :
     Compile error here indicates that the given type is not
     unambiguously convertible to one of the variant's types
     (or that no conversion exists).

c can be converted to boost::recursive_wrapper<c_fwd> though.
Where is the ambiguity?

I really don't know what to do. Help would be appreciated.
Thank you.



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