www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3826] New: init of fixed sized arrays

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3826

           Summary: init of fixed sized arrays
           Product: D
           Version: 2.040
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: sean invisibleduck.org
        ReportedBy: bearophile_hugs eml.cc



import std.stdio: writeln;
void main() {
    alias int[2] T;
    writeln(T.init);
}

I'd like this program has to print [0,0] instead of 0, otherwise generic code
that uses ".init" breaks (I have had to create a function that avoids me to
special-cases such arrays).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3826


Philippe Sigaud <philippe.sigaud gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |philippe.sigaud gmail.com



21:58:34 CET ---
It's even more general than that: (T[n]).init is T.init. It's not even the
correct type!
That seems wrong to me. It should be a T[n] filled with T.init.

int[2] i2; double[3] d2; char[1] c2; string[0] s2;
writeln(typeof(i2).stringof, " ", typeof(typeof(i2).init).stringof);// int[2]
int
writeln(typeof(d2).stringof, " ", typeof(typeof(d2).init).stringof);//
double[3] double

void f(int a) {}
void g(int[2] a) {}

auto i3 = (int[2]).init;
f(i3); // Works. i3 is of type int.
g(i3); // Does not work. i3 is of type int.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 10 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3826




(Probably) fixed in changeset 422

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 28 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3826


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
           Platform|x86                         |All
            Version|2.040                       |D1 & D2
         Resolution|                            |FIXED
         OS/Version|Windows                     |All



This works as expected with the current compiler (2.058 & 1.072)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2012