@@ -3933,7 +3933,8 @@ class cppfront
39333933 auto emit (
39343934 parameter_declaration_node const & n,
39353935 bool is_returns = false ,
3936- bool is_template_parameter = false
3936+ bool is_template_parameter = false ,
3937+ bool emit_identifier = true
39373938 )
39383939 -> void
39393940 {
@@ -4036,13 +4037,27 @@ class cppfront
40364037 if (identifier == " _" ) {
40374038 printer.print_cpp2 ( " UnnamedTypeParam" + std::to_string (n.ordinal ), identifier_pos );
40384039 }
4039- else {
4040+ else if (emit_identifier) {
40404041 printer.print_cpp2 ( identifier, identifier_pos );
40414042 }
40424043
40434044 return ;
40444045 }
40454046
4047+ // -----------------------------------------------------------------------
4048+ // Handle template parameters
4049+
4050+ if (n.declaration ->is_template ()) {
4051+ printer.print_cpp2 (" template " , identifier_pos);
4052+ emit (*n.declaration ->template_parameters , is_returns, true , false );
4053+ printer.print_cpp2 (" class" , identifier_pos);
4054+ if (emit_identifier) {
4055+ printer.print_cpp2 (" " , identifier_pos);
4056+ printer.print_cpp2 ( identifier, identifier_pos );
4057+ }
4058+ return ;
4059+ }
4060+
40464061 // -----------------------------------------------------------------------
40474062 // Else handle template non-type parameters
40484063
@@ -4051,8 +4066,10 @@ class cppfront
40514066
40524067 if (is_template_parameter) {
40534068 emit ( type_id );
4054- printer.print_cpp2 (" " , type_id.position ());
4069+ if (emit_identifier) {
4070+ printer.print_cpp2 (" " , type_id.position ());
40554071 printer.print_cpp2 ( identifier, identifier_pos );
4072+ }
40564073 return ;
40574074 }
40584075
@@ -4263,7 +4280,8 @@ class cppfront
42634280 auto emit (
42644281 parameter_declaration_list_node const & n,
42654282 bool is_returns = false ,
4266- bool is_template_parameter = false
4283+ bool is_template_parameter = false ,
4284+ bool emit_identifier = true
42674285 )
42684286 -> void
42694287 {
@@ -4291,7 +4309,7 @@ class cppfront
42914309 }
42924310 prev_pos = x->position ();
42934311 assert (x);
4294- emit (*x, is_returns, is_template_parameter);
4312+ emit (*x, is_returns, is_template_parameter, emit_identifier );
42954313 if (!x->declaration ->has_name (" this" )) {
42964314 first = false ;
42974315 }
0 commit comments