[Issue 6385] New: isInputRange!(ubyte[2u]) is a failure when used in global scope
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 26 11:18:06 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6385
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
AssignedTo: nobody at puremagic.com
ReportedBy: schveiguy at yahoo.com
--- Comment #0 from Steven Schveighoffer <schveiguy at yahoo.com> 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);
}
outputs:
false
during compilation, and successfully compiles.
See related discussion here:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=28422
--
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