[Issue 9748] Wrong scope of templated nested functions in static foreach

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Oct 16 11:45:53 PDT 2014


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
Even smaller test case report from Mathias Lang:

void main()
{
    {
        void set()(int i) { assert(i); }
        set(1);
    }
    {
        void set()(int i) {}
        set(0);
    }
}

You probably know what's going to happen: the assert would be triggered. The FE
would behave correctly, but backend will mangle the two functions the same way,
leading to the first instance of "set" replacing the second one, and a nice
linker message (Linux x86_64):
/usr/bin/ld: Warning: size of symbol
`_D9a_bug97484mainFZ8__T3setZ3setMFNaNbNiNfiZv' changed from 29 in a_bug9748.o
to 10 in a_bug9748.o

--


More information about the Digitalmars-d-bugs mailing list