[Issue 728] New: incorrect initialisation of member arrays if an explicit struct initializer is used

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 23 05:11:42 PST 2006


http://d.puremagic.com/issues/show_bug.cgi?id=728

           Summary: incorrect initialisation of member arrays if an explicit
                    struct initializer is used
           Product: D
           Version: 0.177
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: thomas-dloop at kuehne.cn


(Originally reported by Andrew Fedoniouk <news at terrainformatica.com>
on 2005-03-10 in news:d0otkq$1fsg$1 at digitaldaemon.com)

#
# import std.stdio;
#
# struct S{
#    int i;
#    int[4] bar = 4;
# }
#
# S a = {i: 1};
# S b;
#
# void main(){
#    writefln("a.bar: %s", a.bar);
#    writefln("b.bar: %s", b.bar);
# }
#

output:
> a.bar: [4,0,0,0]
> b.bar: [4,4,4,4]

expected output:
> a.bar: [4,4,4,4]
> b.bar: [4,4,4,4]

test cases:
http://dstress.kuehne.cn/run/struct_initialization_06.d


-- 



More information about the Digitalmars-d-bugs mailing list