Bug 11866 – `@safe` and `nothrow` attributes aren't inferred for nested functions in templated functions

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-05T00:35:00Z
Last change time
2014-01-05T00:43:42Z
Keywords
rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2014-01-05T00:35:09Z
This code should compile: --- void g(T)() { void f(){ } f(); } void main() @safe nothrow // line 7 { g!int(); // line 9 } --- main.d(9): Error: safe function 'D main' cannot call system function 'main.g!int.g' main.d(9): Error: 'main.g!int.g' is not nothrow main.d(7): Error: function 'D main' is nothrow yet may throw --- E.g. `std.algorithm.countUntil` isn't `nothrow` because of this as it uses nested `pred2`.
Comment #1 by k.hara.pg — 2014-01-05T00:43:42Z
*** This issue has been marked as a duplicate of issue 10329 ***