Bug 12147 – Any bitfield with member named "version" will fail to compile
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-12T17:00:00Z
Last change time
2014-02-12T19:16:48Z
Assigned to
nobody
Creator
bdsatish
Comments
Comment #0 by bdsatish — 2014-02-12T17:00:23Z
If the member of any bitfield is named "version", then the compilation fails.
Example:
import std.bitmanip;
struct S {
mixin(bitfields!(uint, "version", 8));
}
Compilation error:
/d944/f401.d(5): Error: no identifier for declarator uint
/d944/f401.d(5): Error: semicolon expected, not 'version'
/d944/f401.d(5): Error: identifier or integer expected, not )
/d944/f401.d(5): Error: found 'pure' when expecting ')'
/d944/f401.d(5): Error: Declaration expected, not 'return'
/d944/f401.d(6): Error: no identifier for declarator void
/d944/f401.d(6): Error: semicolon expected, not 'version'
Comment #1 by dlang-bugzilla — 2014-02-12T19:16:48Z
"version" is a reserved keyword in D. Since std.bitmanip will declare properties for each bitfield, they must be valid D identifiers, and thus cannot be reserved keywords.