https://d.puremagic.com/issues/show_bug.cgi?id=11866
Summary: `@safe` and `nothrow` attributes aren't inferred for
nested functions in templated functions
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Denis Shelomovskij <[email protected]> 2014-01-05
12:35:09 MSK ---
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`.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------