www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20428] New: Precondition bug for in/out

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

          Issue ID: 20428
           Summary: Precondition bug for in/out
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: cr tagion.org

Created attachment 1770
  --> https://issues.dlang.org/attachment.cgi?id=1770&action=edit
This file contains test example and a log file

Hej Alle.
This the pre-condtion bug has been around for a while now, and it is stated
that it should be fixed.
But it doesn't seem to be.
I have test that this bug is in alle version dmd/ldc2/gdc.

I my view the pre- and post-conditions stated in an interface or and abstract
member function should also be apply to the class which implements this
function or overide the this member function

Ex.
interface I {
    int func(int x)
        in {
            assert(x < 10);
        }
}

class C : I {
    int func(int x) {
        return x*x;
    }
}

So I would expect the C.func function to fail if I call it with value 11, but
it does not.

In the attachment you can find a log-file and the and test example.
The logfile also include information about the OS and the compiler versions use
to test this bug.

Keep up the good work!

--
Dec 04 2019