Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
farmerpiki opened this issue Jun 8, 2023 · 1 comment
Open

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

farmerpiki opened this issue Jun 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@farmerpiki
Copy link
Contributor

farmerpiki commented Jun 8, 2023

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
@farmerpiki farmerpiki added the bug Something isn't working label Jun 8, 2023
@ntrel
Copy link
Contributor

ntrel commented Jun 12, 2023

Also destructuring values returned from a function isn't implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants