Thread overview
[Issue 7557] New: Sea of errors after template failure
Feb 21, 2012
Don
Feb 21, 2012
Vladimir Panteleev
Feb 21, 2012
Don
Feb 21, 2012
Vladimir Panteleev
Feb 21, 2012
Walter Bright
February 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7557

           Summary: Sea of errors after template failure
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: clugdbug@yahoo.com.au


--- Comment #0 from Don <clugdbug@yahoo.com.au> 2012-02-21 03:14:52 PST ---
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);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7557


Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com


--- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-02-21 09:26:43 PST ---
Is this the same problem where an error in one module causes errors in completely different modules (e.g. Phobos)?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7557



--- Comment #2 from Don <clugdbug@yahoo.com.au> 2012-02-21 11:55:31 PST ---
(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)();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7557



--- Comment #3 from Vladimir Panteleev <thecybershadow@gmail.com> 2012-02-21 12:04:41 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7557



--- Comment #4 from github-bugzilla@puremagic.com 2012-02-21 15:41:47 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7557


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2012-02-21 15:42:17 PST ---
https://github.com/D-Programming-Language/dmd/pull/755

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------