[Boost-bugs] [Boost C++ Libraries] #12082: x3::forward_ast ambiguous call

Subject: [Boost-bugs] [Boost C++ Libraries] #12082: x3::forward_ast ambiguous call
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-03-21 02:00:24


#12082: x3::forward_ast ambiguous call
----------------------------------+---------------------
 Reporter: mikhail.strelnikov@… | Owner: djowel
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
  Version: Boost 1.60.0 | Severity: Problem
 Keywords: |
----------------------------------+---------------------
 Following code works for boost::variant but fails for
 boost::spirit::x3::variant with '''error: call of '(const c)
 (boost::spirit::x3::forward_ast<s1>&)' is ambiguous'''


 {{{
 #define USE_SPIRIT_X3_VARIANT 1

 #include <boost/fusion/include/define_struct_inline.hpp>
 #include <boost/spirit/home/x3/support/ast/variant.hpp>
 #include <boost/variant.hpp>

 struct s1;

 #if USE_SPIRIT_X3_VARIANT == 1
 using s2 = boost::spirit::x3::variant<long,
 boost::spirit::x3::forward_ast<s1> >;
 #else
 using s2 = boost::variant<long, boost::recursive_wrapper<s1> >;
 #endif

 BOOST_FUSION_DEFINE_STRUCT_INLINE
 (
     s1,
     (s2, v1)
 )

 BOOST_FUSION_DEFINE_STRUCT_INLINE
 (
     magic,
     (int*, v1)
 )

 struct c
 {
     int operator()(long) const { return 0; }
     int operator()(s1) const { return 1; }
     int operator()(magic) const { return 3; }
 };

 int main()
 {
     s2 s; s = s1{};
     return boost::apply_visitor(c(), s);
 }

 }}}

 [http://melpon.org/wandbox/permlink/BPdeuyNPLINriCr3]

 As you can see, `magic` class does not belong to the variant, but still
 causes compilation error.

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