[Issue 2133] New: anonymous enum without {} doesn't work as asm value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 27 19:43:28 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2133

           Summary: anonymous enum without {} doesn't work as asm value
           Product: D
           Version: 2.014
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: chris at edesix.com


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() {}


-- 



More information about the Digitalmars-d-bugs mailing list