[Issue 20771] New: va_arg doesn't work for structs with postblits

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 26 14:42:26 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20771

          Issue ID: 20771
           Summary: va_arg doesn't work for structs with postblits
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

This prints:
Postblit = 0:2:153259628:

```
void testVariadic(T)(int nargs, ...)
{
    printf(T.stringof ~ "= ");
    foreach(i; 0 .. nargs)
    {
        auto arg = va_arg!T(_argptr);
        static if (__traits(compiles, arg.value))
            printf("%d", arg.value);
            //assert(arg.value == i);
        else
            assert(arg == T.init);
        printf(":");
    }
    printf("\n");
}

struct Postblit
{
    int value;
    this(this) nothrow { }  // nothrow ?
}

void test2()
{
    auto a0 = Postblit(0);
    auto a1 = Postblit(1);
    auto a2 = Postblit(2);
    testVariadic!Postblit(3, a0, a1, a2);
}
```

--


More information about the Digitalmars-d-bugs mailing list