Not very important but I'd like to know if it's possible... so try this with DMD

```d
module runnable;

// The OK part
int ok1(){return 1;}
int ok2(){return 2;}

void OK()
{
    ulong r;
    asm
    {
        xor R8, R8;
        call ok1;
        add R8, RAX;
        call ok2;
        add R8, RAX;
        mov r, R8;
    }
    assert(r == 3);
}

// The NG part
int ng(int i)() => i;
static foreach (i; 1..3)
    alias T = ng!i;

void NG()
{
    ulong r;
    asm
    {
        xor R8, R8;
        call _D8runnable__T2ngVii1ZQiFNaNbNiNfZi;
        add R8, RAX;
        call _D8runnable__T7ngVii2ZQnFNaNbNiNfZi;
        add R8, RAX;
        mov r, R8;
    }
    assert(r == 3);
}

int main()
{
    OK();
    NG();
    return 0;
}
```

so you'll get

Error: function `runnable.NG` label `_D8runnable__T2ngVii1ZQiFNaNbNiNfZi` is undefined Error: function `runnable.NG` label `_D8runnable__T7ngVii2ZQnFNaNbNiNfZi` is undefined

So to keep things simples the idea is to provide a valid function identifier in the asm. I've used compiler explorer to get the __valid__ mangled version (https://godbolt.org/z/WYMqMhnWG). No luck.

Is that even possible ?

Reply via email to