Skip to content

[BUG] impossible to use destructuring in for loops #500

Open
@farmerpiki

Description

@farmerpiki

the following code:
a : std::map<u32, std::string> = ();
// populate map
for a do (k,v) {
... do stuff ...
}

I also tried:
for a do ([k, v]) {
for a do ([k, v]: ) {
for a do (k:
, v:) {
for a do ([k:
, v:_]) {
for a do ((k, v)) {
the versions with brakets complain about requiring a parameter after
the versions without complain about the comma after the parameter

Steps to reproduce the behavior:

  1. Sample code - distilled down to minimal essentials please
    provided above
  2. Command lines including which C++ compiler you are using
    cppfront file.cpp2
    g++-13 (though it doesn't get to it)
  3. Expected result - what you expected to happen
    be able to destructure something in a for loop
  4. Actual result/error
    there's no intuitive syntax to do this as of yet

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions