https://issues.dlang.org/show_bug.cgi?id=18058

Seb <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #2 from Seb <[email protected]> ---
FWIW that attributes are set wrongly on lazy parameters and their function is a
well-known bug and has been around for a long time. See e.g. issue 12647
(there's quite a list of duplicates attached to it). There even have been two
PRs (see issue 12647 for a list) aimed at fixing them, but they didn't tackle
the root problem.


The problem becomes easy to inspect if one uses the hidden -vcg-ast flag at the
compiler.

For the example linked at 

--
import object;
void assertThrown(E)(lazy E expression)
{
        expression();
}
void main()
{
        assertThrown(delegate int() => 0);
        return 0;
}
assertThrown!int
{
        pure @safe void assertThrown(lazy int expression) // <- should have
nothrow
        {
                expression();
        }

}
---

For yours:

---
import object;
@nogc void func1(lazy scope string msg)
{
}
void func2(lazy scope string msg)
{
        func1(delegate string() => msg()); // <- lambda doesn't have @nogc
}
---

--

Reply via email to