-
Notifications
You must be signed in to change notification settings - Fork 261
[FIX] Add support for multi-level pointers #93
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
[FIX] Add support for multi-level pointers #93
Conversation
e5c77bb
to
9fe1be7
Compare
On the second thought, I am also not using index so nevertheless the range-for is better for (auto _ : n.pointer_declarators) {
printer.print_cpp2("*", n.position());
} I was thinking of using |
I just spend couple of minutes meditating @hsutter comment (that I have modified for this change) // TODO: Generalize this -- for now we detect only multi-level cases of the form "p: ***int = ...;"
// We don't recognize pointer types that are deduced or from Cpp1 and I did some tests that makes me add |
Handling of pointer deduced types are done here: #94 |
Pointers from cpp1 are handled here #96 |
9fe1be7
to
ced84b7
Compare
Add support for pointers as template arguments s : std::span<*char> = (argv, gsl::narrow_cast<std::size_t>(argc)); // works |
7e5c596
to
be63722
Compare
be63722
to
05a40f9
Compare
f6bfe6e
to
bd15d7c
Compare
bd15d7c
to
dd1cdd0
Compare
dd1cdd0
to
92e4add
Compare
@filipsajdak Would you be interested in updating the good/current parts of #93, #94, and #96 and merging them into a new PR to replace these? |
Yes. I will. |
Replaced by #196 |
Current implementation supports only pointer of the form
p: *int = ...;
This change extends that to allow multi-level pointers and make below code compilable
and generates the cpp1 code
Closes #78 and makes possible to implement correct main function with arguments.
Open issues
This change still does not support deduced pointer types (just like the current implementation). That means:
pa = 0;
will cause an error as cppfront knows that pa is a pointer to pointer
but this code:
will pass lifetime safety guarantee checks and will compile to cpp1 code:
Having multi-level pointer makes that issue more important to be fixed as it is easier to deduce a pointer from pointer to pointer.