www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16631] New: Program crash when a version activates a method

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

          Issue ID: 16631
           Summary: Program crash when a version activates a method
                    defined in a static library
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

A program crashes when it's linked with a static library and if a version
specification is used to activate the protected method of a class.

reproduction:

=== lib.d ===
module lib;

class Foo
{
    protected void bug(){}

    protected version(bug) void conditionalBug(){}

    void test() {bug;}
}
=============

=== main.d ===
module main;

import lib;

void main()
{
    (new Foo).test;
}
==============

=== test.sh ====
dmd lib.d -lib
dmd main.d lib.a -version=bug
./main
================

output:

./test.sh : ligne 3 :  3096 Erreur de segmentation  ./main

This is caused by the front end because the same error appends with latest
stable LDC. Latest stable DMD is affected, latest beta too.

--
Oct 20 2016