Reported by bearophile.
More of a Sea++ of errors, it reminds me of Another Language.
It's because ScopeExp::semantic() doesn't use template instances if global.errors is true.
Test case (not reduced, relies on D2 Phobos where writefln is a template):
import std.stdio;
T[] findroot(T)(in T x)
{
writefln("xxx");
}
void main()
{
findroot(1.0L);
}
Comment #1 by dlang-bugzilla — 2012-02-21T09:26:43Z
Is this the same problem where an error in one module causes errors in completely different modules (e.g. Phobos)?
Comment #2 by clugdbug — 2012-02-21T11:55:31Z
(In reply to comment #1)
> Is this the same problem where an error in one module causes errors in
> completely different modules (e.g. Phobos)?
I don't think so. This is one is very simple, it's not a module order dependency, it's a failure to run semantic at all.
But, it'
Here is case b. Different symptoms, same root cause. The static assert should be triggered, despite the error in the enum declaration:
-------------
struct W
{
void blaz(T)() {static assert(0); }
}
void main()
{
enum int blah = "abc";
W m;
m.blaz!(int)();
}
Comment #3 by dlang-bugzilla — 2012-02-21T12:04:41Z
OK. Here's the output of the problem I've encountered:
C:\Projects\DFeed\ae\demo\http> dbuild httpserve.d
C:\Projects\ae\sys\shutdown.d(24): Error: function ae.sys.signals.addSignalHandler (int signum, void delegate() fn) is not callable using argument types (int,void)
C:\Projects\ae\sys\shutdown.d(24): Error: cannot implicitly convert expression (shutdown()) of type void to void delegate()
Above are correct errors (I forgot a &). The error messages below are unrelated to the above problems, and go away after I add the &.
C:\Soft\dmd2d\src\phobos\std\string.d(538): Error: expression isSomeChar!(char) of type void does not have a boolean value
C:\Projects\ae\net\http\server.d(71): Error: template std.string.indexOf(Char) if (isSomeChar!(Char)) does not match any function template declaration
C:\Projects\ae\net\http\server.d(71): Error: template std.string.indexOf(Char) if (isSomeChar!(Char)) cannot deduce template function from argument types !()(string,string
)
C:\Soft\dmd2d\src\phobos\std\string.d(448): Error: constraint isSomeChar!(char) is not constant or does not evaluate to a bool
C:\Soft\dmd2d\src\phobos\std\string.d(612): Error: constraint isSomeChar!(char) is not constant or does not evaluate to a bool
C:\Soft\dmd2d\src\phobos\std\algorithm.d(3893): Error: expression isInputRange!(string) of type void does not have a boolean value
C:\Soft\dmd2d\src\phobos\std\algorithm.d(3963): Error: expression isInputRange!(string) of type void does not have a boolean value
C:\Soft\dmd2d\src\phobos\std\algorithm.d(4015): Error: expression isInputRange!(string) of type void does not have a boolean value
C:\Projects\ae\net\http\server.d(93): Error: template std.algorithm.startsWith(alias pred = "a == b",Range,Ranges...) if (isInputRange!(Range) && Ranges.length > 1 && is(t
ypeof(.startsWith!(pred)(doesThisStart,withOneOfThese[0])) : bool) && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[1..__dollar])) : uint)) does not match any
function template declaration
C:\Projects\ae\net\http\server.d(93): Error: template std.algorithm.startsWith(alias pred = "a == b",Range,Ranges...) if (isInputRange!(Range) && Ranges.length > 1 && is(t
ypeof(.startsWith!(pred)(doesThisStart,withOneOfThese[0])) : bool) && is(typeof(.startsWith!(pred)(doesThisStart,withOneOfThese[1..__dollar])) : uint)) cannot deduce templ
ate function from argument types !()(string,string)
C:\Soft\dmd2d\src\phobos\std\string.d(538): Error: expression isSomeChar!(char) of type void does not have a boolean value
C:\Projects\ae\net\http\server.d(98): Error: template std.string.indexOf(Char) if (isSomeChar!(Char)) does not match any function template declaration
C:\Projects\ae\net\http\server.d(98): Error: template std.string.indexOf(Char) if (isSomeChar!(Char)) cannot deduce template function from argument types !()(string,string
)
C:\Soft\dmd2d\src\phobos\std\conv.d(253): Error: constraint isImplicitlyConvertible!(string,uint) is not constant or does not evaluate to a bool
C:\Soft\dmd2d\src\phobos\std\conv.d(358): Error: constraint isStaticArray!(string) is not constant or does not evaluate to a bool
C:\Soft\dmd2d\src\phobos\std\conv.d(450): Error: expression isImplicitlyConvertible!(string,uint) of type void does not have a boolean value
C:\Soft\dmd2d\src\phobos\std\conv.d(500): Error: expression isImplicitlyConvertible!(string,uint) of type void does not have a boolean value
C:\Soft\dmd2d\src\phobos\std\conv.d(572): Error: expression isImplicitlyConvertible!(string,uint) of type void does not have a boolean value
( ... 962 lines omitted ... )
I can't reproduce this right now, but should I try to reduce this problem if I encounter it again, or is this a known bug?
I remember seeing this issue a long time ago, but not recently - until a few days ago. So I think it was triggered by the "soldier on" change, like this bug.
Comment #4 by github-bugzilla — 2012-02-21T15:41:47Z