Skip to content

Commit 07eef02

Browse files
committed
fix(parse): make template-argument-list optional
1 parent 9584fcc commit 07eef02

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
main: () -> int = std::plus<>(0, 0);

source/parse.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4454,15 +4454,6 @@ class parser
44544454
// Remember current position, in case this < is isn't a template argument list
44554455
auto start_pos = pos;
44564456

4457-
// And since we'll do this in two places, factor it into a local function
4458-
auto back_out_template_arg_list = [&]{
4459-
// Aha, this wasn't a template argument list after all,
4460-
// so back out just that part and return the identifier
4461-
n->open_angle = source_position{};
4462-
n->template_args.clear();
4463-
pos = start_pos;
4464-
};
4465-
44664457
n->open_angle = curr().position();
44674458
next();
44684459

@@ -4477,8 +4468,7 @@ class parser
44774468
term.arg = std::move(i);
44784469
}
44794470
else {
4480-
back_out_template_arg_list();
4481-
return n;
4471+
break;
44824472
}
44834473
n->template_args.push_back( std::move(term) );
44844474
}
@@ -4492,7 +4482,11 @@ class parser
44924482
// next term.comma = curr().position();
44934483

44944484
if (curr().type() != lexeme::Greater) {
4495-
back_out_template_arg_list();
4485+
// Aha, this wasn't a template argument list after all,
4486+
// so back out just that part and return the identifier
4487+
n->open_angle = source_position{};
4488+
n->template_args.clear();
4489+
pos = start_pos;
44964490
return n;
44974491
}
44984492
n->close_angle = curr().position();

0 commit comments

Comments
 (0)