1 /* REQUIRED_ARGS: 2 PERMUTE_ARGS: 3 TEST_OUTPUT: 4 --- 5 fail_compilation/test16365.d(22): Error: 'this' reference necessary to take address of member f1 in @safe function main 6 fail_compilation/test16365.d(24): Error: cannot implicitly convert expression `&f2` of type `void delegate() pure nothrow @nogc @safe` to `void function() @safe` 7 fail_compilation/test16365.d(28): Error: address of variable `s` assigned to `dg` with longer lifetime 8 fail_compilation/test16365.d(29): Error: dg.funcptr cannot be used in @safe code 9 --- 10 */ 11 12 // https://issues.dlang.org/show_bug.cgi?id=16365 13 14 struct S 15 { f1S16 void f1() @safe { } 17 } 18 main()19void main() @safe 20 { 21 void function() @safe f; 22 f = &S.f1; 23 void f2() @safe { } 24 f = &f2; 25 26 void delegate() @safe dg; 27 S s; 28 dg = &s.f1; 29 f = dg.funcptr; 30 } 31