D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2866 - Can't declare static struct inside function scope
Summary: Can't declare static struct inside function scope
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2009-04-20 21:27 UTC by David Simcha
Modified: 2015-06-09 01:26 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2009-04-20 21:27:45 UTC
void foo() {
    static struct Bar {
        uint doStuff() {
            return a;
        }
    }
}

D:\code\test.d(4): basic type expected, not struct
D:\code\test.d(4): no identifier for declarator int
D:\code\test.d(4): semicolon expected, not 'struct'

Before nested structs, one could declare a non-nested struct inside a function scope by simply omitting the static keyword.
Comment 1 David Simcha 2010-08-11 14:12:17 UTC
This appears to have been fixed at some point in the past.