Skip to content

Commit 6644bd4

Browse files
committed
Add hint for Cpp1 new expressions, closes #418
With thanks to @ntrel, thanks Nick!
1 parent d6b4c2c commit 6644bd4

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

regression-tests/test-results/version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

2-
cppfront compiler v0.2.1 Build 8520:0928
2+
cppfront compiler v0.2.1 Build 8520:1228
33
Copyright(c) Herb Sutter All rights reserved
44

55
SPDX-License-Identifier: CC-BY-NC-ND-4.0
66
No commercial use
77
No forks/derivatives
8-
FAQ: Why? Because this is a personal experiment at this time
8+
(At this time, while this is a personal experiment)
99

1010
Absolutely no warranty - try at your own risk

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"8520:0928"
1+
"8520:1228"

source/common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,8 @@ class cmdline_processor
777777
print("\nSPDX-License-Identifier: CC-BY-NC-ND-4.0");
778778
print("\n No commercial use");
779779
print("\n No forks/derivatives");
780-
print("\nFAQ: Why? Because this is a personal experiment at this time\n");
780+
print("\n Note: This license emphasizes that this is a personal");
781+
print("\n experiment; it will be upgraded if that changes\n");
781782
print("\nAbsolutely no warranty - try at your own risk\n");
782783
}
783784

source/parse.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3776,7 +3776,7 @@ class parser
37763776
}
37773777
if (curr().type() != lexeme::RightBracket)
37783778
{
3779-
error("unexpected text - [ is not properly matched by ]");
3779+
error("unexpected text - [ is not properly matched by ]", true, {}, true);
37803780
return {};
37813781
}
37823782
term.expr_list->close_paren = &curr();
@@ -3791,7 +3791,7 @@ class parser
37913791
return {};
37923792
}
37933793
if (curr().type() != lexeme::RightParen) {
3794-
error("unexpected text - ( is not properly matched by )");
3794+
error("unexpected text - ( is not properly matched by )", true, {}, true);
37953795
return {};
37963796
}
37973797
term.expr_list->close_paren = &curr();
@@ -4469,6 +4469,13 @@ class parser
44694469
next();
44704470
}
44714471

4472+
else {
4473+
if (*n->identifier == "new") {
4474+
error( "use 'new<" + curr().to_string(true) + ">', not 'new " + curr().to_string(true) + "'", false);
4475+
return {};
4476+
}
4477+
}
4478+
44724479
return n;
44734480
}
44744481

0 commit comments

Comments
 (0)