www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12741] New: DMD accepts functions with contracts and no body

https://issues.dlang.org/show_bug.cgi?id=12741

          Issue ID: 12741
           Summary: DMD accepts functions with contracts and no body
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: briancschott gmail.com

DMD accepts the following:

-----
interface SomeInterface
{
    void doStuff(int x) in { assert (x < 100); }
}
-----

The grammar specification states that a body statement is required when an in
or out contract is specified.

FunctionBody:
    BlockStatement
    BodyStatement
    InStatement BodyStatement
    OutStatement BodyStatement
    InStatement OutStatement BodyStatement
    OutStatement InStatement BodyStatement

--
May 12 2014