On 2/11/2012 1:11 AM, Martin Nowak wrote:
On Sat, 11 Feb 2012 09:09:51 +0100, Walter Bright <[email protected]> 
wrote:



On 2/10/2012 11:12 AM, Masahiro Nakagawa wrote:
On Sat, Feb 11, 2012 at 3:49 AM, Walter Bright <[email protected]
<mailto:[email protected]>> wrote:



    On 2/10/2012 8:59 AM, Masahiro Nakagawa wrote:

        Following code works on dmd 2.057, but causing segmentation fault on
        dmd 2.058 beta.

        -----
        struct S
        {
           void foo(V)(in V v)
           {
           }

           void foo(Args...)(auto ref const Args args)
           {
               foreach (i, T; Args)
                   foo(args[i]);
           }
        }

        void main()
        {
           S s;
           s.foo(10);
        }
        ----

        Does anyone report this issue?
        This bug is critical for my msgpack-d and related libraries.


    This compiles for me without error. When it runs, I get a stack overflow.
    The reason looks clear - foo(Args) is recursively calling itself. I don't
    think it's a bug in dmd.


I retried above code using new beta on two environments.

Mac OS X 10.6.8 causes segmentation fault, but
Scientific Linux release 6.0 64bit works fine.

Does D allow above code?

Do you mean the compiler seg faults or the compiled program seg faults?

/usr/bin/ld: Warning: size of symbol `_D3bug1S10__T3fooTiZ3fooMFxiZv' changed from 64 in bug.o to 55 in bug.o Both instantiations have the same mangling. The linkers seem to chose different ones.


I'm sorry, this is completely confusing.

1. Is the seg fault in dmd or the compiled program?

2. bug.o and then bug.o ??
_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta

Reply via email to