www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10817] New: Linker error with postcondition contract in a release library

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10817

           Summary: Linker error with postcondition contract in a release
                    library
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: david.eckardt sociomantic.com


--- Comment #0 from David Eckardt <david.eckardt sociomantic.com> 2013-08-13
07:14:27 PDT ---
****

// Module in a library, compiled with -release
module a;

class A
{
    int f ( )
    out (x)    {assert(x);}
    body {return 1;}
}

****

// User code, compiled without -release
module b;

import a;

class B: A
{
    override int f ( ) {return super.f();}
}

int main ( )
{
    return (new B).f();
}

****

$ dmd -lib -release a.d
$ dmd b.d -La.a
b.o: In function `_D1b1B1fMFZi':
b.d:(.text._D1b1B1fMFZi+0x60): undefined reference to
`_D1a1A1fMFZi8__ensureMFKiZv'

Apparently B.f() references the postcondition of A.f(), which it overrides, but
that is omitted because A is compiled with -release.
This is very unfortunate as it can make it impossible to use a library that is
compiled with -release.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10817


David Eckardt <david.eckardt sociomantic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |contracts, industry,
                   |                            |link-failure


--- Comment #1 from David Eckardt <david.eckardt sociomantic.com> 2013-08-13
07:18:50 PDT ---
The industry in this case is sociomantic.com.

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