← Back to index
|
Original Bugzilla link
Bug 12704 – typeof function literal incorrectly infers attributes
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-05T19:53:00Z
Last change time
2014-06-20T03:29:27Z
Keywords
pull
Assigned to
nobody
Creator
code
Comments
Comment #0
by code — 2014-05-05T19:53:44Z
cat > bug.d << CODE void foo() @system; alias FuncLitT = typeof(function() { foo(); }); static assert(is(FuncLitT == void function() @system)); CODE dmd -c bug ---- bug.d(3): Error: static assert (is(void function() pure @safe == void function() @system)) is false ---- Interestingly nothrow is inferred correctly, only pure and @safe are broken. Might be related to bug 12561.
Comment #1
by code — 2014-05-05T19:55:19Z
Workaround: enum FuncLit = function(){ foo(); }; alias FuncLitT = typeof(FuncLit);
Comment #2
by k.hara.pg — 2014-05-07T03:56:06Z
I think this is a bug.
https://github.com/D-Programming-Language/dmd/pull/3530
Comment #3
by github-bugzilla — 2014-05-07T18:21:53Z
Commits pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/e3557a0fff2a29d873b08d830e68a4d1f3afcca9
fix Issue 12704 - typeof function literal incorrectly infers attributes
https://github.com/D-Programming-Language/dmd/commit/694a6304b8e2c6c4b759c4925f09d12577d4bd8e
Merge pull request #3530 from 9rnsr/fix12704 Issue 12704 - typeof function literal incorrectly infers attributes
Comment #4
by k.hara.pg — 2014-06-20T03:29:27Z
*** Issue 12561 has been marked as a duplicate of this issue. ***