[Issue 2474] Recursive lazy arguments are inlined incorrectly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 27 07:42:57 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2474


smjg at iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg at iname.com
            Version|2.021                       |1.036




------- Comment #1 from smjg at iname.com  2008-11-27 09:42 -------
>> dmd inlinebug.d -c -inline
> inlinebug.d(5): delegate inlinebug.foo.bar.__dgliteral1 is a nested function
> and cannot be accessed from foo

Presumably, inlining changes

    return bar();

to

    return foo(bar());

after which it tries to TRO the foo call, but gets mixed up as it relies on the
nested function bar.

I'm not sure if the compiler is actually within its rights to complain about
this, as it's bad code even though not technically illegal.  And if such bad
code interferes with optimisation, should the compiler error or just not bother
with the optimisation?

> Without the -inline flag this code compiles and works as expected.

As in throws a stack overflow?

> The same bug is present in DMD 1.037.

And 1.036 and 2.020.  AIUI if the same bug occurs in both D1 and D2, it is
preferred to file it under the D1 version.


-- 



More information about the Digitalmars-d-bugs mailing list