Bug 13481 – bug with inferring attributes from built-in properties
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-09-16T09:59:00Z
Last change time
2015-02-18T03:37:06Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
amir
Comments
Comment #0 by amir — 2014-09-16T09:59:09Z
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-@nogc function '_adSort'
It seems that function attributes in the anonymous case are inferred incorrectly?
Comment #1 by bearophile_hugs — 2014-09-16T10:03:01Z
(In reply to Amir Abiri from comment #0)
> mixin test!(&sort_arr);
> void sort_arr()
> {
> arr.sort;
> }
The built-in sort will die soon.