Bug 5505 – std.functional: Fix for possible lurking bug & replace complex return type with auto
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-01-29T16:23:00Z
Last change time
2012-04-20T23:47:09Z
Assigned to
andrei
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-01-29T16:23:06Z
In DMD 2.051, std.functional, line 53:
enum testAsStmts = "{"~ElementType.stringof~" "~parmName~"; "~fun~"}()";
I think the line is missing a semicolon after "~fun~". Fixed:
enum testAsStmts = "{"~ElementType.stringof~" "~parmName~"; "~fun~";}()";
But the code that uses the enum is commented out for some reason.
Line 250, binaryReverseArgs:
Why not replace this complex return type:
typeof({ ElementType1 a; ElementType2 b; return pred(b, a);}())
binaryReverseArgs(ElementType1, ElementType2)(ElementType1 a,
ElementType2 b)
{
return pred(b, a);
}
with the simpler:
auto binaryReverseArgs(ElementType1, ElementType2)(ElementType1 a,
ElementType2 b)
{
return pred(b, a);
}
unittests will still pass.