www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11866] New: ` safe` and `nothrow` attributes aren't inferred for nested functions in templated functions

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg gmail.com> 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: -------
Jan 05 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11866


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2014-01-05 00:43:42 PST ---
*** This issue has been marked as a duplicate of issue 10329 ***

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 05 2014