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.
Comment #2 by k.hara.pg — 2014-09-17T11:41:10Z
Comment #3 by github-bugzilla — 2014-09-18T22:32:22Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1ac90637b9667dcf05ac6d721867a6e496a2a502 fix Issue 13481 - bug with inferring attributes from built-in properties https://github.com/D-Programming-Language/dmd/commit/add92c65170738734262746f17623316de36c4ae Merge pull request #4001 from 9rnsr/fix13481 Issue 13481 - bug with inferring attributes from built-in properties
Comment #4 by github-bugzilla — 2015-02-18T03:37:06Z