D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3047 - Foreach on tuple produces incorrect result (D1 only)
Summary: Foreach on tuple produces incorrect result (D1 only)
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2009-06-02 08:48 UTC by Sean Kelly
Modified: 2019-09-27 08:34 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Sean Kelly 2009-06-02 08:48:54 UTC
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.
Comment 1 Don 2010-07-16 10:49:22 UTC
This was fixed in DMD2.047, but not in 1.062.
Comment 2 RazvanN 2019-09-27 08:34:25 UTC
D1 is no longer supported, so closing as WONTFIX.