Skip to content

Bad srcML output when handling init of type auto& in ranged-based for #2330

@EnderHubris

Description

@EnderHubris
int main() {
    for (auto the_val : myCollection) {}
    for (auto& the_val : myCollection) {} // issue occurs due to the & operator
    for (int& the_val : myCollection) {}
}

In the markup the init and range tags are missing.

<for>for <control>(<init><decl><type><name>auto</name></type> <name>the_val</name> <range>: <expr><name>myCollection</name></expr></range></decl></init>)</control> <block>{<block_content/>}</block></for>

<for>for <control>(<init><expr><name>auto</name><operator>&amp;</operator> <name>the_val</name> <operator>:</operator> <name>myCollection</name></expr></init>)</control> <block>{<block_content/>}</block></for>

<for>for <control>(<init><decl><type><name>int</name><modifier>&amp;</modifier></type> <name>the_val</name> <range>: <expr><name>myCollection</name></expr></range></decl></init>)</control> <block>{<block_content/>}</block></for>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions