Thread overview
[Issue 3388] New: [tdpl] contracts should allow throw expressions
Oct 19, 2009
Don
Nov 22, 2009
Leandro Lucarella
Nov 24, 2009
Koroskin Denis
Dec 06, 2009
Walter Bright
October 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3388

           Summary: [tdpl] contracts should allow throw expressions
           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


--- Comment #0 from Andrei Alexandrescu <andrei@metalanguage.com> 2009-10-12 13:25:03 PDT ---
Consider:

void fun(int x)
in {
    if (x < 0) throw new Exception("a");
}
body {
}

This doesn't compile with:

Error: Throw statements cannot be in contracts

This is a useless limitation because a contract could always call a function that throws an arbitrary exception. So effectively the only effect is that it makes it difficult for functions to throw custom exceptions when their contracts are violated. The limitation should be lifted.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-10-19 04:13:46 PDT ---
This seems to work if you just comment out the error (statement.c 4299)
(BTW a nothrow function can have a contract which calls functions that
may throw.
Not sure if that's OK or not, probably not but I think it's not urgent).

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


Leandro Lucarella <llucax@gmail.com> changed:

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


--- Comment #2 from Leandro Lucarella <llucax@gmail.com> 2009-11-22 14:34:43 PST ---
SVN commit: http://www.dsource.org/projects/dmd/changeset/261

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


Koroskin Denis <2korden@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |2korden@gmail.com


--- Comment #3 from Koroskin Denis <2korden@gmail.com> 2009-11-24 04:04:42 PST ---
*** Issue 3400 has been marked as a duplicate of this issue. ***

-- 
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=3388


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2009-12-06 00:52:33 PST ---
Fixed dmd 2.037

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