Thread overview
[Issue 3269] New: pure functions silently become nothrow
Oct 27, 2009
Don
Oct 29, 2009
Leandro Lucarella
Nov 06, 2009
Walter Bright
August 28, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3269

           Summary: pure functions silently become nothrow
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrei@metalanguage.com


class A
{
    pure static void raise(string s)
    {
        throw new Exception(s);
    }
}

void main()
{
    A.raise("a");
}

This code compiles and runs without an error!

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, wrong-code


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-10-27 12:22:53 PDT ---
// A pure function might have side effects, unless it is also nothrow. // PATCH:     e2ir.c, line 288.

    e = el_una(op,tyret,ep);
    }
    else if (ep) {
-    e = el_bin(tf->ispure ? OPcallns : OPcall,tyret,ec,ep);
+    e = el_bin((tf->ispure && tf->isnothrow) ? OPcallns : OPcall,tyret,ec,ep);
    }
    else {
-    e = el_una(tf->ispure ? OPucallns : OPucall,tyret,ec);
+    e = el_una((tf->ispure && tf->isnothrow) ? OPucallns : OPucall,tyret,ec);
    }

    if (retmethod == RETstack)

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


Leandro Lucarella <llucax@gmail.com> changed:

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


--- Comment #2 from Leandro Lucarella <llucax@gmail.com> 2009-10-29 14:38:17 PDT ---
Related SVN revision: http://www.dsource.org/projects/dmd/changeset/226

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


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-11-06 11:33:47 PST ---
Fixed dmd 2.036

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