[Issue 1836] New: Inline assembler can't use enum values as parameters.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 14 12:41:47 PST 2008


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

           Summary: Inline assembler can't use enum values as parameters.
           Product: D
           Version: 1.026
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: burton-radons at shaw.ca


The inline assembler rejects any attempt to use an enum value as a parameter:

        enum
        {
                enumeration = 1,
        }

        void test ()
        {
                asm
                {
                        mov EAX, enumeration;
                }
        }

This code fails compilation with "bad type/size of operands 'enumeration'",
regardless of whether enum is given a type or if AX or AH is attempted instead.
It should be equivalent to "mov EAX, 1;".

The workaround is to assign the enumeration value to a const value before the
asm statement.


-- 



More information about the Digitalmars-d-bugs mailing list