Re: Linking error when changing > to >>
Larry Evans <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 11/20/2016 05:28 PM, Larry Evans wrote:
> On 11/20/2016 12:21 PM, Exagon wrote:
>> Besids the linking errors when switch from > to >> in this example, I am
>> getting a lot of linker errors, when I try to use boost::optional as a
>> member of an attribute
>>
>> for example when I change
>>
>> auto const var_dec_def = x3::lexeme["var "]
>> > +x3::alnum
>> > ":"
>> > type
>> > ";";
>>
>> to
>>
>> auto const var_dec_def = x3::lexeme["var "]
>> > +x3::alnum
>> > ":"
>> > -type //type is now optional
>> > ";";
>>
>> and dont change something in the ast, it compiles fine, but when I change
>>
>> struct VariableDec {
>> std::string _name;
>> Type _type;
>> };
>>
>> to
>>
>> struct VariableDec {
>> std::string _name;
>> boost::optional<Type> _type;
>> };
>>
>> I am getting a linking error again.
>> Is this a bug or am I doing soemthing stupid?
>> If this is a totaly different topic, I will invest some time and create
>> another repo with a more minimal example to show my problem with this.
>>
>> Greetings Exagon
>
> Try the latest update here:
>
> https://github.com/cppljevans/spirit/blob/ExagonLinkingError/include/boost/spirit/home/x3/nonterminal/rule.hpp
>
> Unfortunately, I've no idea how many more extract_rule_attr overloads
> may be needed to handle all situations. I don't even know if the
> use of extract_rule_attr overloads is correct (it may handle the
> attributes differently than "standard" boost). I'm still trying
> to understand how attributes are handled in boost code. I can read
> the user documentation; however, I still need to read the code
> to see how it's done, and that's taking a while :(
>
[snip]
The latest version
has a workaround which works for your case. The solution
moves the attribute transformation from:
https://github.com/cppljevans/spirit/blob/ExagonLinkingError/include/boost/spirit/home/x3/nonterminal/detail/rule.hpp#L322
to:
https://github.com/cppljevans/spirit/blob/ExagonLinkingError/include/boost/spirit/home/x3/nonterminal/rule.hpp#L201
the commit msg:
https://github.com/cppljevans/spirit/commit/cb8d31b87f4ac32687b0164769e4c569932cd6e1
shows the compile&run. The segfault at the end disappears
if the BOOST_SPIRIT_X3_DEBUG is undefined.
HTH.
-regards,
Larry
------------------------------------------------------------------------------