www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5617] New: repeat(value, n) fails to compile

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: jmdavisProg gmx.com



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: -------
Feb 19 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5617


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



PST ---
Okay. I take that back. It appears to be something wrong with my system. For
some reason, if I'm in my home directory, it's grabbing the wrong libphobos2.a
or something. I have no clue what the deal with it is, but there are other
problems (such as there being no std.array.join and there being a
std.string.join) which indicate that the wrong libphobos2.a is being used when
I build from my home directory. So, I expect that repeat(value, n) is a newer
version of the function that whatever version of the library is being pulled in
doesn't have.

In any case, this isn't a real bug. It's just something weird with my system
that I'll have to sort out, which makes a _lot_ more sense to me (much as my
problem doesn't make sense), since looking at repeat, I can't see how the error
that I'm getting could possibly happen with the current version of Phobos. The
function is just so simple that it seems like it _has_ to work.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 19 2011