Summary: isInputRange!(ubyte[2u]) is a failure when used in
                    global scope
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD

--- Comment #0 from Steven Schveighoffer <> 2011-07-26 
11:18:02 PDT ---
The following code incorrectly produces an error:

import std.range;

pragma(msg, isInputRange!(ubyte[2u]).stringof);

Error: template instance std.array.front!(ubyte[2u]) incompatible arguments for
template instantiation

The code of isInputRange looks like this:

template isInputRange(R)
    enum bool isInputRange = is(typeof(
        R r;              // can define a range object
        if (r.empty) {}   // can test for empty
        r.popFront();     // can invoke popFront()
        auto h = r.front; // can get the front of the range

It was my impression that is(typeof(...)) should just return false on
compilation failure.  I don't think isInputRange is incorrectly implemented.

The error is eliminated if you put the isInputRange call inside a function:

import std.range;

void main() { 
pragma(msg, isInputRange!(ubyte[2u]).stringof);



during compilation, and successfully compiles.

See related discussion here:

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to