view tests/mini/naked_asm3.d @ 1192:3251ce06c820

Started seperating type resolution from the rest of codegen again, the merge had too many regressions.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Fri, 03 Apr 2009 16:34:11 +0200
parents bbb3f23908aa
children
line wrap: on
line source

int foo()
{
    enum { fourty2 = 42 }
    version(X86)
    asm
    {
        naked;
        mov EAX, fourty2;
        ret;
    }
    else version(X86_64)
    asm
    {
        naked;
        mov EAX, fourty2;
        ret;
    }
    else static assert(0, "todo");
}

void main()
{
    int i = foo();
    printf("i == %d\n", i);
    assert(i == 42);
}

extern(C) int printf(char*, ...);