Bug 4985 – A missing length problem in typecons.Tuple
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-10-03T13:30:00Z
Last change time
2010-10-08T12:43:25Z
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2010-10-03T13:30:17Z
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 by rsinfu — 2010-10-07T16:07:28Z
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 by bearophile_hugs — 2010-10-08T12:43:25Z
(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.