www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13481] New: bug with inferring attributes from built-in


          Issue ID: 13481
           Summary: bug with inferring attributes from built-in properties
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: amir abiri.org

Using the following mixin template:

mixin template test(void function() callback)
    static this()

The following code snippet works fine:

mixin test!(&sort_arr);
void sort_arr()

However attempting to turn it into an anonymous function like so:

mixin test!({ arr.sort; });

Results in this error:

Error: safe function 'main.__lambda6' cannot call system function '_adSort'
Error:  nogc function 'main.__lambda6' cannot call non- nogc function '_adSort'

It seems that function attributes in the anonymous case are inferred

Sep 16 2014