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

Boby of one-liner ranged-based for discarded #161

Closed
hrjonashansen opened this issue Apr 5, 2019 · 1 comment
Closed

Boby of one-liner ranged-based for discarded #161

hrjonashansen opened this issue Apr 5, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@hrjonashansen
Copy link

The following snippet creates a c-style array and prints the elements one by one. However, the printing part is not included in the output of cppinsights.io.

Snippet:

#include <iostream>

int main(int argc, char** argv)
{
    char arr[10]{2,4,6,8};
    for (auto i : arr)
        std::cout << i << " ";
}

Output:

#include <iostream>

int main(int argc, char ** argv)
{
  char arr[10] = {2, 4, 6, 8, '\0', '\0', '\0', '\0', '\0', '\0'};
  {
    char (&__range1)[10] = arr;
    char * __begin1 = __range1;
    char * __end1 = __range1 + 10l;
    for(; __begin1 != __end1; ++__begin1) 
    {
      char i = *__begin1;
    }
    
  }
}
@andreasfertig
Copy link
Owner

Hello @hrjonashansen,

thanks for reporting that! Indeed that statement got lost in the process. A fix is on its way.

Andreas

andreasfertig added a commit that referenced this issue Apr 5, 2019
Fixed #161: Show single-line body of for or range-based for loops.
@andreasfertig andreasfertig added the bug Something isn't working label Jun 28, 2019
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