standardese / cppast

Library to parse and work with the C++ AST
Other
1.7k stars 164 forks source link

Multidimensional array wrong to_string() representation #129

Closed deadlocklogic closed 2 years ago

deadlocklogic commented 2 years ago

Consider:

int array[][1];

Printing the type of this variable to output stream gives int[1][1] What is wrong here?

By the way, @foonathan sorry for spamming the issue tracker, but I am trying to report pitfalls/possible bugs in order to improve this good library. Thanks.

foonathan commented 2 years ago

By the way, @foonathan sorry for spamming the issue tracker,

No problem, I just have no time to look into the issues right now. Feel free to report anything you find though, I'll get back to you in two weeks or so.

foonathan commented 2 years ago

Well, two months is almost like two weeks :D Fixed now, thanks for reporting.

deadlocklogic commented 2 years ago

No problem! 😅 By the way, any plans for a libtooling backend? Or a better solution for template member specializations? Knowing if a class is abstract or final etc... gives huge advantage when generating bindings. Thanks!

foonathan commented 2 years ago

By the way, any plans for a libtooling backend?

No, libtooling isn't really usable outside of clang's source tree and has frequent API changes.

Knowing if a class is abstract or final etc... gives huge advantage when generating bindings.

This is already supported.

final: https://github.com/foonathan/cppast/blob/e558e2d58f519e3a83af770d460672b1d4ba2886/include/cppast/cpp_class.hpp#L204

abstract: check whether it has a member which is pure virtual https://github.com/foonathan/cppast/blob/e558e2d58f519e3a83af770d460672b1d4ba2886/include/cppast/cpp_member_function.hpp#L43