D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5505 - std.functional: Fix for possible lurking bug & replace complex return type with auto
Summary: std.functional: Fix for possible lurking bug & replace complex return type wi...
Status: RESOLVED DUPLICATE of issue 7878
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-29 16:23 UTC by Andrej Mitrovic
Modified: 2012-04-20 23:47 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 Andrej Mitrovic 2011-01-29 16:23:06 UTC
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.
Comment 1 Kenji Hara 2012-04-20 23:47:09 UTC
Simplifying binaryReverseArgs is now proposed in the pull for bug 7878.
https://github.com/D-Programming-Language/phobos/pull/544

So I'd merge this to 7878.

*** This issue has been marked as a duplicate of issue 7878 ***