[Issue 3379] New: [tdpl] Parameter names not visible in the if clause of a template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 8 14:25:58 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3379
Summary: [tdpl] Parameter names not visible in the if clause of
a template
Product: D
Version: unspecified
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrei at metalanguage.com
--- Comment #0 from Andrei Alexandrescu <andrei at metalanguage.com> 2009-10-08 14:25:57 PDT ---
This code does not compile:
T1[] find(T1, T2)(T1[] longer, T2[] shorter)
if (is(typeof(longer[0 .. 1] == shorter) : bool))
{
while (longer.length >= shorter.length) {
if (longer[0 .. shorter.length] == shorter) break;
longer = longer[1 .. $];
}
return longer;
}
unittest {
double[] d1 = [ 6.0, 1.5, 2.4, 3 ];
double[] d2 = [ 1.5, 2.4 ];
assert(find(d1, d2) == d1[1 .. $]);
}
(I believe I'd submitted this bug already. Please don't mark as duplicate so
all TDPL-related errors stay together.)
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list