[Issue 5617] New: repeat(value, n) fails to compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 19 21:44:22 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5617

           Summary: repeat(value, n) fails to compile
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2011-02-19 21:41:43 PST ---
Take this program:

import std.range;

void main()
{
    auto a = take(repeat(5), 2);
    auto b = repeat(5, 2);
}

results in

test.d(6): Error: template std.range.repeat(T) does not match any function
template declaration
test.d(6): Error: template std.range.repeat(T) cannot deduce template function
from argument types !()(int,int)

The first line in main compiles but the second doesn't, even though the two
lines are supposed to be equivalent. What's particularly baffling is that the
body of repeat(value, n) is essentially identical to the first line in main.
So, I really don't know what's going on here, but regardless, repeat(value, n)
appears to be broken.

-- 
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