digitalmars.D.bugs - [Issue 20772] New: va_arg doesn't work for structs with copy
- d-bugmail puremagic.com (46/46) Apr 26 2020 https://issues.dlang.org/show_bug.cgi?id=20772
https://issues.dlang.org/show_bug.cgi?id=20772 Issue ID: 20772 Summary: va_arg doesn't work for structs with copy constructors Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: ibuclaw gdcproject.org This prints: CopyConstructor = 64:0:2: ``` 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 CopyConstructor { int value; this(int v) { this.value = v; } this(ref typeof(this) other) { this.value = other.value; } } void test4() { auto a0 = CopyConstructor(0); auto a1 = CopyConstructor(1); auto a2 = CopyConstructor(2); testVariadic!CopyConstructor(3, a0, a1, a2); } ``` --
Apr 26 2020