www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5182] New: ICE(expression.c): calling unittest from a function

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5182

           Summary: ICE(expression.c): calling unittest from a function
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ibuclaw ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw ubuntu.com> 2010-11-06 13:52:04 PDT ---
Simplest testcase:

unittest{}
void main() {
    __unittest1();
}


I'm honestly not sure if this is supposed to be legal code. But DMD 2.046
accepts and runs it without problems.

Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 06 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5182


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com


--- Comment #1 from Iain Buclaw <ibuclaw ubuntu.com> 2010-11-06 14:02:30 PDT ---
Oops, sorry, told a while lie.

The program compiles + runs when you pass the compiler flag -unittest, but ICEs
when you don't.

Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 06 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5182



--- Comment #2 from Iain Buclaw <ibuclaw ubuntu.com> 2010-11-08 03:14:28 PST ---
Patch to make SEGV an error:

--- dmd.orig/expression.c       2010-11-08 10:32:15.492440000 +0000
+++ dmd/expression.c    2010-11-08 10:39:28.404440000 +0000
   -2324,6 +2324,11   

         if (!f->originalType && f->scope)       // semantic not yet run
             f->semantic(f->scope);
+        if (f->isUnitTestDeclaration())
+        {
+            error("cannot call unittest function '%s'", toChars());
+            return new ErrorExp();
+        }
         if (!f->type->deco)
         {
             error("forward reference to %s", toChars());


Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 08 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5182


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> 2010-12-04
23:48:43 PST ---
http://www.dsource.org/projects/dmd/changeset/779

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