Skip to content

Regression introduced: value type in context in rule_parser started changing #294

@andreasbuhr

Description

@andreasbuhr

A regression was introduced in c674e94.

Since that commit, the call method of rule_parser which does take an Attribute by reference uses the type of that Attribute to construct the context.
Since that commit, _val(ctx) in the actions can be whatever the consumer passes as Attribute to call().
But the value in the context, and thereby _val(ctx) in the actions, should always be the attribute of the rule_parser.

This becomes a problem when the rule_parser is used in an opt_parser. The opt_parser relies on the fact that it can pass its optional into the underlying parser, because the std::optional<Foo> can be constructed from Foo. But then therein, I suddenly get std::optional<Foo> as _val(ctx) in my actions, where I assume it would be just a Foo.

I'll create a pull request with a reproducer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions