<div class="gmail_quote">On Mon, Apr 9, 2012 at 8:48 AM, Florian Goujeon <span dir="ltr">&lt;<a href="mailto:florian.goujeon@42ndart.org">florian.goujeon@42ndart.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div style="font-family:-moz-fixed;font-size:12px" lang="x-western">Hello,
      <br>
      <br>
      I&#39;m modelizing a syntax tree using boost::variant, std::tuple and
      <br>
      std::vector. This syntax tree has a lot of cyclic dependencies, so
      I have
      <br>
      to use boost::recursive_wrapper along with forward declarations.
      <br>
      <br>
      I&#39;ve encountered a case that my compiler (GCC 4.7) refuses to
      build.
      <br>
      Here is the source code: <a href="http://pastebin.com/3a5xU06x" target="_blank">http://pastebin.com/3a5xU06x</a>
      (it&#39;s pretty short)
      <br>
      Here is the compilation error message: <a href="http://pastebin.com/Zpa3TCp2" target="_blank">http://pastebin.com/Zpa3TCp2</a>
      <br>
      <br>
      (Of course, reordering the declarations would solve the problem in
      this
      <br>
      example, but it&#39;s not the point. This is a constraint I can&#39;t get
      rid of
      <br>
      in my whole project.)
      <br>
      <br>
      The compiler complains about an ambiguous call of
      convert_construct() in
      <br>
      Boost&#39;s source code, where a comment says:
      <br>
          NOTE TO USER :
      <br>
          Compile error here indicates that the given type is not
      <br>
          unambiguously convertible to one of the variant&#39;s types
      <br>
          (or that no conversion exists).
      <br>
      <br>
      c can be converted to boost::recursive_wrapper&lt;c_fwd&gt;
      though.
      <br>
      Where is the ambiguity?
      <br>
      <br>
      I really don&#39;t know what to do. Help would be appreciated.
      <br>
      Thank you.
      <br></div></div></blockquote><div><br>It *looks* like it&#39;s getting confused with the conversion constructor that constructs one variant type from another.<br><br>Let&#39;s see, it&#39;s trying to match<br><br>convert_construct(c_fwd&amp;, long int)<br>
<br>and the candidates it&#39;s considering are<br><br>variant&lt; rw&lt;c_fwd&gt; &gt;::convert_construct(c_fwd&amp;, int, mpl_::false_)<br>variant&lt; rw&lt;?_fwd&gt; &gt;::convert_construct(variant&lt;double,char*&gt;&amp;, long int)<br>
variant&lt; rw&lt;c_fwd&gt; &gt;::convert_construct(const variant&lt;double,char*&gt;&amp;, long int)<br><br>[rw == recursive_variant; looks like there were problems with your copy paste but I&#39;m guessing ?_fwd == c_fwd.]<br>
<br>c_fwd inherits from c, which is the variant&lt;double,char*&gt; that pops up above. So yeah, there&#39;s definitely an ambiguity there.<br><br>I don&#39;t know if that&#39;s an error in the implementation of variant, or an error on your side, but does that help you diagnose the problem in any way? Sorry, the chain of stuff that&#39;s suppose to happen in the statement &quot;a a_node(b_node);&quot; is too much for me to wrap my head around at the moment, with all the recursively defined a&#39;s, b&#39;s, and c&#39;s :/<br>
<br>- Jeff<br><br></div></div>

