D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3670 - Declarator grammar rule is broken
Summary: Declarator grammar rule is broken
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-03 22:41 UTC by Jerry Quinn
Modified: 2015-06-09 01:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jerry Quinn 2010-01-03 22:41:38 UTC
http://digitalmars.com/d/2.0/declaration.html

As defined, the Declarator rule prevents parsing a simple function such as

void foo() {}

The problem is that BasicType2 cannot be optional in Declarator

Parsing gives

Declaration
Decl
BasicType Declarator FunctionBody
void Declarator FunctionBody
void BasicType2 Identifier DeclaratorSuffixes FunctionBody
void BasicType2 foo DeclaratorSuffixes FunctionBody
void BasicType2 foo DeclaratorSuffix FunctionBody
void BasicType2 foo Parameters FunctionBody
void BasicType2 foo () FunctionBody
void BasicType2 foo () {}

There is no valid expansion for BasicType2
Comment 1 Walter Bright 2010-02-12 16:22:06 UTC
Changeset 1420
Comment 2 Walter Bright 2010-03-08 22:21:46 UTC
Fixed dmd 1.057 and 2.041