7557 – Sea of errors after template failure

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7557 - Sea of errors after template failure
Summary: Sea of errors after template failure
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: diagnostic
Depends on:
Blocks:
Reported: 2012年02月21日 03:14 UTC by Don
Modified: 2015年06月09日 05:11 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2012年02月21日 03:14:52 UTC
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 Vladimir Panteleev 2012年02月21日 09:26:43 UTC
Is this the same problem where an error in one module causes errors in completely different modules (e.g. Phobos)?
Comment 2 Don 2012年02月21日 11:55:31 UTC
(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 Vladimir Panteleev 2012年02月21日 12:04:41 UTC
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 github-bugzilla 2012年02月21日 15:41:47 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/36e214a3789c11d4102e53b63bf0f5283b0c6b67
fix Issue 7557 - Sea of errors after template failure
Comment 5 Walter Bright 2012年02月21日 15:42:17 UTC
https://github.com/D-Programming-Language/dmd/pull/755 


AltStyle によって変換されたページ (->オリジナル) /