@@ -1071,6 +1071,10 @@ class cppfront
1071
1071
assert (n.identifier );
1072
1072
emit (*n.identifier );
1073
1073
1074
+ for (auto _ : n.pointer_declarators ) {
1075
+ printer.print_cpp2 (" *" , n.position ());
1076
+ }
1077
+
1074
1078
if (!n.template_args .empty ()) {
1075
1079
printer.print_cpp2 (" <" , n.open_angle );
1076
1080
auto first = true ;
@@ -1572,9 +1576,9 @@ class cppfront
1572
1576
auto & unqual = std::get<id_expression_node::unqualified>(id->id );
1573
1577
assert (unqual);
1574
1578
auto decl = sema.get_declaration_of (*unqual->identifier );
1575
- // TODO: Generalize this -- for now we detect only cases of the form "p: *int = ...;"
1576
- // We don't recognize pointer types that are deduced, multi-level, or from Cpp1
1577
- if (decl && decl->declaration && decl->declaration ->pointer_declarator ) {
1579
+ // TODO: Generalize this -- for now we detect only multi-level cases of the form "p: ** *int = ...;"
1580
+ // We don't recognize pointer types that are deduced or from Cpp1
1581
+ if (decl && decl->declaration && ! decl->declaration ->pointer_declarators . empty () ) {
1578
1582
if (n.ops .empty ()) {
1579
1583
last_postfix_expr_was_pointer = true ;
1580
1584
}
@@ -2155,10 +2159,6 @@ class cppfront
2155
2159
}
2156
2160
else {
2157
2161
emit ( id_expr );
2158
- if (n.declaration ->pointer_declarator ) {
2159
- printer.print_cpp2 (" " , n.declaration ->pointer_declarator ->position ());
2160
- emit (*n.declaration ->pointer_declarator );
2161
- }
2162
2162
}
2163
2163
2164
2164
// Then any suffix
@@ -2538,9 +2538,6 @@ class cppfront
2538
2538
}
2539
2539
printer.preempt_position (n.position ());
2540
2540
emit ( *type );
2541
- if (n.pointer_declarator ) {
2542
- printer.print_cpp2 (" *" , n.position ());
2543
- }
2544
2541
// one pointer is enough for now, pointer-to-function fun can be later
2545
2542
if (!n.initializer ) {
2546
2543
printer.print_cpp2 ( " >" , n.position () );
0 commit comments