www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20023] New: Separate compilation breaks dip1000 / dip1008

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

          Issue ID: 20023
           Summary: Separate compilation breaks dip1000 / dip1008  safety
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

// test.d
import test2;
void main()
{
    threw!()();
}

// test2.d
auto threw()()  safe
{
    try
        throw new Exception("Hello");
    catch (Exception e)
        return e;
    assert(0);
}





Happy to compile despite the bug


test2.d(6): Error: scope variable e may not be returned
test.d(5): Error: template instance `test2.threw!()` error instantiating

Catches the problem correctly

--
Jul 03 2019