D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5114 - Too many error messages with main(;
Summary: Too many error messages with main(;
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 minor
Assignee: No Owner
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2010-10-24 18:29 UTC by bearophile_hugs
Modified: 2012-01-21 21:52 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-10-24 18:29:24 UTC
This is a wrong program:


void main() {
    main(;
}


But DMD 2.049 shows too many errors:


test.d(2): expression expected, not ';'
test.d(3): found '}' when expecting ','
test.d(3): expression expected, not 'EOF'
test.d(3): found 'EOF' when expecting ','
test.d(3): expression expected, not 'EOF'
test.d(3): found 'EOF' when expecting ','
test.d(3): expression expected, not 'EOF'
test.d(3): found 'EOF' when expecting ','
test.d(3): expression expected, not 'EOF'
test.d(3): found 'EOF' when expecting ','
test.d(3): expression expected, not 'EOF'
test.d(3): found 'EOF' when expecting ','
test.d(3): expression expected, not 'EOF'
test.d(3): found 'EOF' when expecting ','
test.d(3): expression expected, not 'EOF'
test.d(3): found 'EOF' when expecting ','
test.d(3): expression expected, not 'EOF'
test.d(3): found 'EOF' when expecting ','
test.d(3): expression expected, not 'EOF'
test.d(3): found 'EOF' when expecting ','
test.d(3): expression expected, not 'EOF'
Comment 2 bearophile_hugs 2012-01-21 18:21:23 UTC
After the latest DMD updates (minutes ago), the program now gives me:


test.d(2): expression expected, not ';'
test.d(3): found '}' when expecting ','
test.d(3): found 'EOF' when expecting ')'
test.d(3): found 'EOF' when expecting ';' following statement
test.d(3): found 'EOF' when expecting '}' following compound statement


This is an improvement.

Note: among the errors I don't see the "premature end of file" error message that's inside Walter change:

+
+            if (token.value == TOKeof)
+            {   error("premature end of file");
+                break;
+            }
Comment 3 yebblies 2012-01-21 21:52:31 UTC
(In reply to comment #2)
> Note: among the errors I don't see the "premature end of file" error message
> that's inside Walter change:
> 
> +
> +            if (token.value == TOKeof)
> +            {   error("premature end of file");
> +                break;
> +            }

This is inside Parser::parseEnum - when eof is encountered inside and enum declaration's body.