www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20771] New: va_arg doesn't work for structs with postblits

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 puremagic.com
          Reporter: ibuclaw 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);
}
```

--
Apr 26