cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

[BUG] Add support for defining pointer to pointers.

Open leejy12 opened this issue 3 years ago • 1 comments
trafficstars

Hi, I am very interested in this project's future!

Cppfront fails to compile this code

main: () -> int = {
    a:     int = 2;
    pa:   *int = a&;
    ppa: **int = pa&;
    return a*pa**ppa**; // 8
}

As of now, ppa: **int = pa&; does not work.

leejy12 avatar Oct 17 '22 08:10 leejy12

That is true. As a workaround you can use type aliases.

filipsajdak avatar Oct 17 '22 14:10 filipsajdak

@leejy12 Thanks, fixed with commit e1b57cf026041cef33d4f95ae230513ada29fa51 .

This now works (note spacing around *, otherwise it's your example):

main: () -> int = {
    a:     int = 2;
    pa:   *int = a&;
    ppa: **int = pa&;
    std::cout << a * pa* * ppa**; // 8
}

Thanks!

hsutter avatar Dec 29 '22 00:12 hsutter