Bug 2133 – anonymous enum without {} doesn't work as asm value

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2008-05-27T21:43:00Z
Last change time
2015-06-09T01:21:36Z
Assigned to
bugzilla
Creator
chris

Comments

Comment #0 by chris — 2008-05-27T21:43:27Z
The anonymous enum syntax allows the {} to be omitted if there is only one value, as described under "Manifest Constants" in the spec. However, they seem to behave differently to single value anonymous enums that do have braces when used as immediate values in the inline assembler. Test case... import std.string; enum n1 = 42; enum { n2 = 42 } uint retN1() { asm { mov EAX,n1; // No! - mov EAX,-4[EBP] } } uint retN2() { asm { mov EAX,n2; // OK - mov EAX,02Ah } } unittest { assert( retN1() == 42, "expected 42, got "~toString( retN1() ) ); assert( retN2() == 42, "expected 42, got "~toString( retN2() ) ); } void main() {}
Comment #1 by bugzilla — 2008-06-22T18:57:59Z
Fixed dmd 2.015