Thread overview
[Issue 3469] New: ICE in func.c
Nov 03, 2009
Ellery Newcomer
[Issue 3469] ICE(func.c): Regression. Calling non-template function as a template, from another module
Nov 03, 2009
Don
Nov 03, 2009
Don
Dec 06, 2009
Walter Bright
November 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3469

           Summary: ICE in func.c
           Product: D
           Version: 2.035
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: ellery-newcomer@utulsa.edu


--- Comment #0 from Ellery Newcomer <ellery-newcomer@utulsa.edu> 2009-11-02 18:35:20 PST ---
// tok.d

import tok2;

class B{
 A a;
 void b(){
   a.call!(MOTHER)("HI MUM");
 }
}


// tok2.d

class A{
 void call(string s){
 }
}

//__EOF__

okay, compile like so:

$ dmd tok tok2
    Error: identifier 'MOTHER' is not defined

$ dmd tok2 tok
    Error: identifier 'MOTHER' is not defined
    dmd: func.c:135: virtual void FuncDeclaration::semantic(Scope*): Assertion
`semanticRun <= 1' failed.
    Aborted

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3469


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.035                       |1.050
            Summary|ICE in func.c               |ICE(func.c): Regression.
                   |                            |Calling non-template
                   |                            |function as a template,
                   |                            |from another module
         OS/Version|Linux                       |All
           Severity|normal                      |regression


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-11-03 01:05:18 PST ---
Reduced test case.
--- test.d ----------------
import test2;
void b(){
   test2.call!();
}
--- test2.d ---------------
void call(){ }
---------------------------
assert func.c(133) semanticRun <= 1

This is a regression: it worked on DMD 2.026, but failed on 2.030 and later.
Fails on the current D1, as well.
When doing a DotIdExpTemplate call, it doesn't check that thing it's calling is
actually a template.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3469


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-11-03 03:45:48 PST ---
PATCH against DMD2.036. Passes the DMD test suite + phobos unittests. Expression.c, DotTemplateInstanceExp::semantic(). Ensure it's a template BEFORE running the semantic pass.

Index: expression.c ===================================================================
--- expression.c    (revision 234)
+++ expression.c    (working copy)
@@ -6082,6 +6082,14 @@
     goto Lerr;
     }
     s = s2;
+
+    td = s->toAlias()->isTemplateDeclaration();
+    if (!td)
+    {
+    error("%s is not a template", id->toChars());
+    goto Lerr;
+    }
+
     s->semantic(sc);
     s = s->toAlias();
     td = s->isTemplateDeclaration();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3469


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2009-12-06 00:46:48 PST ---
Fixed dmd 1.053 and 2.037

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