File tree Expand file tree Collapse file tree 4 files changed +20
-21
lines changed
regression-tests/test-results Expand file tree Collapse file tree 4 files changed +20
-21
lines changed Original file line number Diff line number Diff line change 1
- pure2-variadics.cpp2:17:20: error: declaration of template parameter ‘UnnamedTypeParam1’ shadows template parameter
2
- pure2-variadics.cpp2:16:10: note: template parameter ‘UnnamedTypeParam1’ declared here
3
- pure2-variadics.cpp2:27:20: error: declaration of template parameter ‘UnnamedTypeParam1’ shadows template parameter
4
- pure2-variadics.cpp2:26:10: note: template parameter ‘UnnamedTypeParam1’ declared here
5
- pure2-variadics.cpp2:17:53: error: declaration of template parameter ‘UnnamedTypeParam1’ shadows template parameter
6
- pure2-variadics.cpp2:17:13: note: template parameter ‘UnnamedTypeParam1’ declared here
7
- pure2-variadics.cpp2:17:98: error: ‘_’ was not declared in this scope
8
- pure2-variadics.cpp2:17:99: error: expected parameter pack before ‘...’
9
- pure2-variadics.cpp2:17:102: error: template argument 1 is invalid
10
- pure2-variadics.cpp2:17:95: error: too many template-parameter-lists
11
- pure2-variadics.cpp2:27:49: error: declaration of template parameter ‘UnnamedTypeParam1’ shadows template parameter
12
- pure2-variadics.cpp2:27:13: note: template parameter ‘UnnamedTypeParam1’ declared here
13
- pure2-variadics.cpp2:27:94: error: ‘_’ was not declared in this scope
14
- pure2-variadics.cpp2:27:95: error: expected parameter pack before ‘...’
15
- pure2-variadics.cpp2:27:98: error: template argument 1 is invalid
16
- pure2-variadics.cpp2:27:91: error: too many template-parameter-lists
Original file line number Diff line number Diff line change @@ -93,13 +93,13 @@ auto main() -> int;
93
93
template <int ...Ts> [[nodiscard]] auto y<Ts...>::func() -> auto { return (0 + ... + Ts); }
94
94
95
95
#line 17 "pure2-variadics.cpp2"
96
- template <typename ...UnnamedTypeParam1_16_14> template <int UnnamedTypeParam1_17_7> [[nodiscard]] auto t0<_ ...>::f() -> cpp2::i32 { return 0 ; }
96
+ template <typename ...UnnamedTypeParam1_16_14> template <int UnnamedTypeParam1_17_7> [[nodiscard]] auto t0<UnnamedTypeParam1_16_14 ...>::f() -> cpp2::i32 { return 0 ; }
97
97
98
98
#line 22 "pure2-variadics.cpp2"
99
99
template <auto ...T> template <int UnnamedTypeParam1_22_7> [[nodiscard]] auto t1<T...>::f() -> cpp2::i32 { return 0 ; }
100
100
101
101
#line 27 "pure2-variadics.cpp2"
102
- template <auto ...UnnamedTypeParam1_26_14> template <int UnnamedTypeParam1_27_7> [[nodiscard]] auto t2<_ ...>::f() -> cpp2::i32 { return 0 ; }
102
+ template <auto ...UnnamedTypeParam1_26_14> template <int UnnamedTypeParam1_27_7> [[nodiscard]] auto t2<UnnamedTypeParam1_26_14 ...>::f() -> cpp2::i32 { return 0 ; }
103
103
104
104
#line 30 "pure2-variadics.cpp2"
105
105
template <typename ...Args> auto left_fold_print (std::ostream& out, Args const & ...args) -> void{
Original file line number Diff line number Diff line change @@ -333,6 +333,15 @@ auto labelized_position(token const* t)
333
333
return ret;
334
334
}
335
335
336
+ auto unnamed_type_param_name (int ordinal, token const * t)
337
+ -> std::string
338
+ {
339
+ return " UnnamedTypeParam"
340
+ + std::to_string (ordinal)
341
+ + " _"
342
+ + labelized_position (t);
343
+ }
344
+
336
345
337
346
// -----------------------------------------------------------------------
338
347
//
Original file line number Diff line number Diff line change @@ -4272,8 +4272,7 @@ class cppfront
4272
4272
}
4273
4273
4274
4274
if (identifier == " _" ) {
4275
- printer.print_cpp2 ( " UnnamedTypeParam" + std::to_string (n.ordinal ) + " _"
4276
- + labelized_position (n.declaration ->identifier ->get_token ()),
4275
+ printer.print_cpp2 ( unnamed_type_param_name (n.ordinal , n.declaration ->identifier ->get_token ()),
4277
4276
identifier_pos );
4278
4277
}
4279
4278
else {
@@ -4929,7 +4928,14 @@ class cppfront
4929
4928
auto separator = std::string{" <" };
4930
4929
for (auto & tparam : parent->template_parameters ->parameters ) {
4931
4930
assert (tparam->has_name ());
4932
- list += separator + tparam->name ()->to_string ();
4931
+ list += separator;
4932
+ if (" _" == tparam->name ()->to_string ()) {
4933
+ list += unnamed_type_param_name (tparam->ordinal ,
4934
+ tparam->declaration ->identifier ->get_token ());
4935
+ }
4936
+ else {
4937
+ list += tparam->name ()->to_string ();
4938
+ }
4933
4939
if (tparam->declaration ->is_variadic ) {
4934
4940
list += " ..." ;
4935
4941
}
You can’t perform that action at this time.
0 commit comments