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

Incorrect return type of a function returning a pointer to an array #81

Closed
rayhamel opened this issue Sep 29, 2018 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@rayhamel
Copy link

rayhamel commented Sep 29, 2018

See #74.

For this snippet

auto f(int i)
{ // also `decltype(auto) f(int i)`, `int(*f(int i))[3]` and `auto f(int i) -> int(*)[3]`
  static int arr[5][3];
  return &arr[i];
}

Insights incorrectly outputs

int (*)[3] f(int i)
{
  static int arr[5][3];
  return &arr[i];
}

and for this snippet

auto *f(int i)
{
  static int arr[5][3];
  return &arr[i];
}

Insights incorrectly outputs

int *[3] f(int i)
{
  static int arr[5][3];
  return &arr[i];
}

instead of the correct output for both snippets.

int(*f(int i))[3]
{
  static int arr[5][3];
  return &arr[i];
}
@rayhamel rayhamel changed the title Incorrect type of a function returning a pointer to an array Incorrect return type of a function returning a pointer to an array Sep 29, 2018
@andreasfertig andreasfertig added the bug Something isn't working label Sep 30, 2018
@andreasfertig
Copy link
Owner

Hello Ray,

thanks again for reporting the shortcomings C++ Insights currently has. A fix is on its way.

andreasfertig added a commit that referenced this issue Sep 30, 2018
Fixed #81: Use the correct syntax for a function returning a pointer to an array.
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