[Issue 13481] New: bug with inferring attributes from built-in properties

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 16 02:59:09 PDT 2014


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

          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 at puremagic.com
          Reporter: amir at abiri.org

Using the following mixin template:

mixin template test(void function() callback)
{
    static this()
    {
        callback();
    }
}

The following code snippet works fine:

mixin test!(&sort_arr);
void sort_arr()
{
    arr.sort;
}

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- at nogc function '_adSort'

It seems that function attributes in the anonymous case are inferred
incorrectly?

--


More information about the Digitalmars-d-bugs mailing list