Skip to content

Commit 673e232

Browse files
committed
Add diagnostic for that a variadic declaration must have a name, closes #708
1 parent 209f6d5 commit 673e232

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

regression-tests/test-results/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
cppfront compiler v0.2.1 Build 8928:1030
2+
cppfront compiler v0.2.1 Build 8928:1101
33
Copyright(c) Herb Sutter All rights reserved
44

55
SPDX-License-Identifier: CC-BY-NC-ND-4.0

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"8928:1030"
1+
"8928:1101"

source/parse.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8312,6 +8312,14 @@ class parser
83128312
return {};
83138313
}
83148314

8315+
if (id->to_string() == "...") {
8316+
errors.emplace_back(
8317+
curr().position(),
8318+
"a variadic declaration must have a name - did you forget to write a name before '...'?"
8319+
);
8320+
pos = start_pos; // backtrack
8321+
}
8322+
83158323
auto is_variadic = false;
83168324
if (curr().type() == lexeme::Ellipsis) {
83178325
is_variadic = true;

0 commit comments

Comments
 (0)