[Issue 16365] New: cannot allow calling function pointer from delegate in @safe code
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Mon Aug  8 03:04:40 PDT 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=16365
          Issue ID: 16365
           Summary: cannot allow calling function pointer from delegate in
                    @safe code
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid, safe
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ag0aep6g at gmail.com
----
struct S
{
    void f1(immutable int* x, int* y) @safe { *y = 13; }
}
void main() @safe
{
    S s;
    void delegate(immutable int*, int*) @safe d = &s.f1;
    void function(immutable int*, int*) @safe f = d.funcptr; /* uh-oh */
    immutable int* x = new int(42);
    assert(*x == 42); /* passes */
    f(x, new int);
    assert(*x == 42); /* fails */
}
----
--
    
    
More information about the Digitalmars-d-bugs
mailing list