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

Ampersand reference appears to be treated as sp_arith after a cast to a custom type #4280

Open
AnthonySWest opened this issue Apr 18, 2024 · 0 comments

Comments

@AnthonySWest
Copy link

Uncrustify version 0.78.1 (also occurs in latest commit for the master branch - 42cbc77).

Use the default config settings, but set sp_arith to force.

A space is added after the reference (&) when it follows a cast, and when the cast is a custom type (not int, double, etc.). It appears to be incorrectly treated as sp_arith.

Expected results:

bool AddEventToList(TEvent event)
{
  EventList->Add((TEvent) &event);
  EventList->Add((int) &event);
  EventList->Add((TEvent) (&event));
  EventList->Add((TEvent*) &event);
}

Actual results:

bool AddEventToList(TEvent event)
{
  EventList->Add((TEvent) & event); // unexpected space after ampersand
  EventList->Add((int) &event);
  EventList->Add((TEvent) (&event)); // wrapping inside parens is a workaround.
  EventList->Add((TEvent*) &event); // if the cast is a pointer, works
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants