Re: Using Tuple and bind in Spirit causes compiler error
Joel de Guzman <[email protected]> Sat, 24 Oct 2020 09:49:48 +0800
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 10/24/20 1:50 am, Juan Dent wrote: > Hi, > > I produced a MVCE with the error at compile time (see line 22 of MVCE.cpp). REMOVING the semantic action deletes the compiler error! > The source is as follows: > ------------------------------------------------------------------------------------------------------------------------------------- If you use clang or g++, this is the error that you will get: /usr/local/include/boost/spirit/home/qi/detail/assign_to.hpp:153:20: error: no matching conversion for static_cast from 'const boost::fusion::vector<boost::optional<double>, boost::optional<int> >' to 'boost::tuples::tuple<boost::optional<double>, boost::optional<int>, ...>' Why is that happening? If you are using semantic actions, the semantic action **WILL** synthesize a suitable attribute for you. In this case, the synthesized attribute is a boost::fusion::vector which **IS NOT*** assignable to a boost::tuple. Suggestion 1: Avoid mixing semantic actions with attributes, unless you really know what you are doing and already gained more proficiency with Spirit. In most cases, you can live without semantic actions. Suggestion 2: Try other compilers. Error messages generated by Visual Studio are often tough to decipher. Regards, -- Joel