www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3047] New: Foreach on tuple produces incorrect result

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

           Summary: Foreach on tuple produces incorrect result
           Product: D
           Version: 2.030
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: sean invisibleduck.org


The following code:

    import std.stdio;
    import std.traits;

    void fn(T...)(T fns)
    {
        foreach(fn; fns)
        {
            writefln( "%s", ParameterTypeTuple!(fn)[0].mangleof );
        }
    }

    void main()
    {
        void a(int x) {}
        void b(double y) {}
        void c(Object z) {}

        fn(&a, &b, &c);
    }

Prints:

    i
    i
    i

When the type output should be int, double, Object, respectively.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 02 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3047


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.030                       |D1
            Summary|Foreach on tuple produces   |Foreach on tuple produces
                   |incorrect result            |incorrect result (D1 only)


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-07-16 10:49:22 PDT ---
This was fixed in DMD2.047, but not in 1.062.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 16 2010