[Issue 15417] Wrong parameter passing for variadic nested functions within aggregate

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Dec 8 03:03:55 PST 2015


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

--- Comment #2 from Mathias Lang <mathias.lang at sociomantic.com> ---
Oops :P

Well, using `c1` doesn't change a thing here (and va_start is not needed here
according to the docs).

Test case closer to the original bug:

```
import std.stdio, core.stdc.stdarg;

class C
{
    private void method ()
    {
        void test (ulong c1, ...)
        {
            check(c1, _argptr, _arguments);
        }
        test(4242UL, char.init);
    }
}

void check (ulong c1, va_list arglist, TypeInfo[] ti)
{
    assert(ti.length == 1);
    assert(ti[0].toString() == "char");
    writeln("Now Segv");
    assert(char.init == va_arg!(char)(arglist));
}

void main ()
{
    auto c = new C;
    c.method;
}
```

This is technically a regression (worked in D1). And obviously it works with
GDC :)

--


More information about the Digitalmars-d-bugs mailing list