Odd Error Message

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 15 14:16:52 PST 2014


CraigDillabaugh:

> Given the following program:
>
> import std.string;
> import std.stdio;
>
> void main()
> {	
> 	File file = File("blah.txt", "r");
> 	
> 	while( !(file.eof()) && count > 10 ) {  //line 8
> 		//
> 	}
> }
>
> I get the error message:
>
> line(8): Error: void has no value

The next error message is:

test.d(8,29): Error: incompatible types for ((count(alias pred = 
"a == b", Range, E)(Range haystack, E needle) if 
(isInputRange!Range && !isInfinite!Range && 
is(typeof(binaryFun!pred(haystack.front, needle)) : bool))) > 
(10)): 'void' and 'int'

So it's referring to std.algorithm.count, that probably is 
imported by one of the other two imports.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list