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

Insight is screwed for top-level variables with type placeholder and an array new expression initializers #108

Closed
languagelawyer opened this issue Jan 10, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@languagelawyer
Copy link

languagelawyer commented Jan 10, 2019

auto p = new int[2];

becomes

int * p = new int[22;

The same happens for the decltype(auto) placeholder.
For multidimensional arrays, each index gets screwed, e.g. [2][3] becomes [22[33.
For index ranges > 9, e.g. [123][456], only the first digit is doubled: [1123[4456.
Hexadecimal integer literals screw it even more. new int[0x02] becomes new in2.
Octal integer literals in multidimensional array new expressions also result in a very funny output. new int[02][03] becomes new int 2][3.

Also note the additional newline added after every such declaration.

There is no problem with non-array new expressions and with array new expression when variable type is not deduced.

@andreasfertig
Copy link
Owner

Hello @languagelawyer,

thanks again for spotting that. Two different AST matchers did match and rewrite the same statement. The result is indeed a bit funny. Fix is on its way.

andreasfertig added a commit that referenced this issue Jan 10, 2019
Fixed #108: Two different matchers did match the same statement.
@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