diff --git a/compiler/src/dmd/parse.d b/compiler/src/dmd/parse.d index 2d18a3cf8fe7..fa003caa4fcc 100644 --- a/compiler/src/dmd/parse.d +++ b/compiler/src/dmd/parse.d @@ -8647,7 +8647,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer error("expression expected, not `%s`", token.toChars()); Lerr: // Anything for e, as long as it's not NULL - e = new AST.IntegerExp(loc, 0, AST.Type.tint32); + e = AST.ErrorExp.get(); nextToken(); break; } diff --git a/compiler/test/fail_compilation/binexperr.d b/compiler/test/fail_compilation/binexperr.d new file mode 100644 index 000000000000..695b2746b186 --- /dev/null +++ b/compiler/test/fail_compilation/binexperr.d @@ -0,0 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/binexperr.d(12): Error: expression expected, not `)` +fail_compilation/binexperr.d(12): Error: missing closing `)` after `if (A1 * (__error)` +--- +*/ + +void main() +{ + struct A1 {} + if (A1*) {} + return; +} diff --git a/compiler/test/fail_compilation/e15876_3.d b/compiler/test/fail_compilation/e15876_3.d index 0482e87a5492..100c5e1ed5a9 100644 --- a/compiler/test/fail_compilation/e15876_3.d +++ b/compiler/test/fail_compilation/e15876_3.d @@ -16,7 +16,7 @@ fail_compilation/e15876_3.d(29): Error: found `End of File` when expecting `)` fail_compilation/e15876_3.d(29): Error: no identifier for declarator `d(_error_ = () { for (__error__ - 0; 0) + __error; __error) { __error__ } diff --git a/compiler/test/fail_compilation/e15876_4.d b/compiler/test/fail_compilation/e15876_4.d index e5c3bbf56733..a9115b92dd54 100644 --- a/compiler/test/fail_compilation/e15876_4.d +++ b/compiler/test/fail_compilation/e15876_4.d @@ -15,7 +15,7 @@ fail_compilation/e15876_4.d(27): Error: found `End of File` when expecting `)` fail_compilation/e15876_4.d(27): Error: no identifier for declarator `typeof(() { for (__error__ - 0; 0) + __error; __error) { __error__ } diff --git a/compiler/test/fail_compilation/ice15855.d b/compiler/test/fail_compilation/ice15855.d index f7ad3900683f..5d1cea1de72b 100644 --- a/compiler/test/fail_compilation/ice15855.d +++ b/compiler/test/fail_compilation/ice15855.d @@ -15,7 +15,7 @@ fail_compilation/ice15855.d(28): Error: found `End of File` when expecting `]` fail_compilation/ice15855.d(28): Error: no identifier for declarator `a[() { for (__error__ - 0; 0) + __error; __error) { __error__ } diff --git a/compiler/test/fail_compilation/ice8795.d b/compiler/test/fail_compilation/ice8795.d index a30a65b200b7..33aa6e4d54b4 100644 --- a/compiler/test/fail_compilation/ice8795.d +++ b/compiler/test/fail_compilation/ice8795.d @@ -3,7 +3,7 @@ TEST_OUTPUT: --- fail_compilation/ice8795.d-mixin-14(14): Error: found `End of File` when expecting `(` fail_compilation/ice8795.d-mixin-14(14): Error: expression expected, not `End of File` -fail_compilation/ice8795.d-mixin-14(14): Error: missing closing `)` after `switch (0` +fail_compilation/ice8795.d-mixin-14(14): Error: missing closing `)` after `switch (__error` fail_compilation/ice8795.d-mixin-14(14): Error: found `End of File` instead of statement fail_compilation/ice8795.d-mixin-15(15): Error: { } expected following `interface` declaration fail_compilation/ice8795.d-mixin-15(15): Error: anonymous interfaces not allowed diff --git a/compiler/test/fail_compilation/misc_parser_err_cov1.d b/compiler/test/fail_compilation/misc_parser_err_cov1.d index a170b77b88c2..4a8875d6d69c 100644 --- a/compiler/test/fail_compilation/misc_parser_err_cov1.d +++ b/compiler/test/fail_compilation/misc_parser_err_cov1.d @@ -24,7 +24,7 @@ fail_compilation/misc_parser_err_cov1.d(40): Error: identifier or `new` expected fail_compilation/misc_parser_err_cov1.d(41): Error: identifier or new keyword expected following `(...)`. fail_compilation/misc_parser_err_cov1.d(41): Error: expression expected, not `;` fail_compilation/misc_parser_err_cov1.d(42): Error: found `}` when expecting `;` following expression -fail_compilation/misc_parser_err_cov1.d(41): expression: `(__error) + 0` +fail_compilation/misc_parser_err_cov1.d(41): expression: `(__error) + (__error)` fail_compilation/misc_parser_err_cov1.d(43): Error: matching `}` expected following compound statement, not `End of File` fail_compilation/misc_parser_err_cov1.d(33): unmatched `{` --- diff --git a/compiler/test/fail_compilation/traits_alone.d b/compiler/test/fail_compilation/traits_alone.d index 8f6f145e6bf4..f516882f8f8b 100644 --- a/compiler/test/fail_compilation/traits_alone.d +++ b/compiler/test/fail_compilation/traits_alone.d @@ -3,7 +3,7 @@ TEST_OUTPUT: --- fail_compilation/traits_alone.d(11): Error: found `End of File` when expecting `(` fail_compilation/traits_alone.d(11): Error: `__traits(identifier, args...)` expected -fail_compilation/traits_alone.d(11): Error: no identifier for declarator `_error_` +fail_compilation/traits_alone.d(11): Error: no identifier for declarator `__error` --- */ //used to segfault