Skip to content

Diagnostics needed for the silently omitted non-unused attribute on the delimiter of delimited_list parser (%) #70

Open

Description

@saki7

Currently the L53 of list parser passes the hard-coded unused attribute for the underlying parser. This leads to surprising result at runtime, where the content of the RHS is silently omitted even if the RHS has some explicit attribute.

if (!detail::parse_into_container(this->left, first, last, ctx, x4::assume_container(attr))) {
return false;
}
It last_parse_it = first;
while (
this->right.parse(last_parse_it, last, ctx, unused) &&
detail::parse_into_container(this->left, last_parse_it, last, ctx, x4::assume_container(attr))
) {

This looks like a bug to me, but fixing this would be a breaking change. We should re-check the unit tests.

A workaround is to rewrite this:

body % delim

to this:

body >> *(delim >> body)

but I think the current behavior is very awkward in the first place.

Activity

  1. added
    bugSomething isn't working
    tests neededUnit tests are required for all public API
    on Mar 5, 2026
  2. saki7 commented on Sep 13, 2026

    @saki7
    MemberAuthor

    This is not a defect, it is the correct semantics; see the updated README.

    The only issue we have here is the lack of the diagnostics. We definitely need some compiler warning for this pattern, otherwise we end up into the similar situation like #79.

  3. removed
    bugSomething isn't working
    on Sep 13, 2026
  4. changed the title [-]list parser (`%`) should not omit the RHS if the attribute of delimiter is not an `unused_type`[/-] [+]Diagnostics needed for the silently omitted non-unused attribute on the delimiter of delimited_list parser (`%`)[/+] on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tests neededUnit tests are required for all public API

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions