Bug 12741 – DMD accepts functions with contracts and no body

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-13T00:31:00Z
Last change time
2015-02-18T03:40:30Z
Keywords
pull, spec
Assigned to
nobody
Creator
briancschott
Blocks
10233

Comments

Comment #0 by briancschott — 2014-05-13T00:31:17Z
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
Comment #1 by jiki — 2014-05-13T01:22:46Z
This is as expected and is a document bug. See: http://dlang.org/interface.html#InterfaceContracts
Comment #2 by k.hara.pg — 2014-09-19T03:22:40Z
Comment #3 by github-bugzilla — 2014-09-23T00:52:16Z
Commits pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/1c970a38fe8925571676a2bd155c00961e651d9a fix Issue 12741 - DMD accepts functions with contracts and no body Support normal function declaration without body. https://github.com/D-Programming-Language/dlang.org/commit/699e98f9a5a80d31380369438506ba0a68466a74 Merge pull request #657 from 9rnsr/fix12741 Issue 12741 - DMD accepts functions with contracts and no body
Comment #4 by github-bugzilla — 2015-02-18T03:40:30Z