Bug 2866 – Can't declare static struct inside function scope
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-04-20T21:27:00Z
Last change time
2015-06-09T01:26:25Z
Keywords
rejects-valid
Assigned to
nobody
Creator
dsimcha
Comments
Comment #0 by dsimcha — 2009-04-20T21:27:45Z
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 by dsimcha — 2010-08-11T14:12:17Z
This appears to have been fixed at some point in the past.