Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue 19225 - Confusing error message on
static else
So users assuming `static else` is fine get a helpful error message.
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/diag19225.d(14): Error: basic type expected, not `else` | ||
fail_compilation/diag19225.d(14): There's no `static else`, use `else` instead. | ||
fail_compilation/diag19225.d(14): Error: found `else` without a corresponding `if`, `version` or `debug` statement | ||
fail_compilation/diag19225.d(15): Error: unrecognized declaration | ||
--- | ||
*/ | ||
|
||
void main() | ||
{ | ||
static if (true) {} | ||
static else {} | ||
} |