D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4985 - A missing length problem in typecons.Tuple
Summary: A missing length problem in typecons.Tuple
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-03 13:30 UTC by bearophile_hugs
Modified: 2010-10-08 12:43 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-10-03 13:30:17 UTC
A (hopefully correct) reduced test case from page 30 of:
http://nwcpp.org/images/stories/nwcpp-2010-09.pdf


import std.concurrency: spawn, send;
void foo() {}
void main() {
    foreach (b; [cast(immutable(ubyte)[])[1]])
        send(spawn(&foo), b);
}



DMD 2.049 shows:
...\dmd\src\phobos\std\typecons.d(336): Error: no property 'length' for type 'immutable(char)'


This is the part of typecons.Tuple that gives the error:

    static string injectNamedFields()
    {
        string decl = "";
        foreach (i, name; staticMap!(extractName, fieldSpecs))
        {
            auto    field = text("Identity!(field[", i, "])");
            auto numbered = text("_", i);
            decl ~= text("alias ", field, " ", numbered, ";");
            if (name.length != 0) // line 336
            {
                decl ~= text("alias ", numbered, " ", name, ";");
            }
        }
        return decl;
    }
Comment 1 Shin Fujishiro 2010-10-07 16:07:28 UTC
Maybe you updated only your std.typecons to the svn trunk and not std.typetuple?  I can't reproduce the reported error unless I roll std.typetuple back.  Please try updating your std.typetuple.
Comment 2 bearophile_hugs 2010-10-08 12:43:25 UTC
(In reply to comment #1)
> Maybe you updated only your std.typecons to the svn trunk and not
> std.typetuple?  I can't reproduce the reported error unless I roll
> std.typetuple back.  Please try updating your std.typetuple.

I don't know what happened, but I have updated std.typetuple and std.typecons, and the problem has gone. So I close this bug report. Thank you Shin Fujishiro.