[Issue 21301] Wrong values being passed in long parameter list

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 17 15:22:04 UTC 2022


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

kdevel <kdevel at vogtner.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kdevel at vogtner.de

--- Comment #2 from kdevel <kdevel at vogtner.de> ---
---v.d
import std.stdio;
unittest {
   void func(T...)(T args)
   {
      writeln ("args = ", args);
      asssert(args[1][0 .. 12] == [1,2,3,4,5,6,7,8,9,10,11,12]);
   }

   byte[12] f2 = [1,2,3,4,5,6,7,8,9,10,11,12];
   float[3] f3 = [1f,2f,3f];

        func(
                0,
                f2, f3,
                0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f,
                0, 0, 0, 0,
        );
}
---
$ dmd --version
DMD64 D Compiler v2.099.0
Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved
written by Walter Bright

$ dmd -g -m64 -unittest -checkaction=context -main -run v
std.exception.ErrnoException@[...]/dmd2/linux/bin64/../../src/phobos/std/stdio.d(3170):
Enforcement failed (Bad address)
...

$ dmd -g -m32 -unittest -checkaction=context -main -run v
args = 0[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12][1, 2, 3]0000000000000
1 modules passed unittests

--


More information about the Digitalmars-d-bugs mailing list