[Issue 11720] Function-local static variables should cause "already defined in another scope" error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 10 18:19:35 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11720


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|tupleof inconsistency       |Function-local static
                   |                            |variables should cause
                   |                            |"already defined in another
                   |                            |scope" error


--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2013-12-10 18:19:25 PST ---
This is unrelated bug to tupleof property.
compile-time iterated foerach loop is unrolled to multiple scope statements.

    foreach (T; TypeTuple!(int, double))
    {
        static temp = T.stringof;
    }
    // is equivalent to:
    { static temp = int.stringof; }
    { static temp = double.stringof; }

Then, two static temp variables have exactly same mangled name, so they
conflicts and should cause linker error at least.
However, all of instantiated code will be placed in COMDAT section, so they
incorrectly share the storage.

Changed the summary.

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


More information about the Digitalmars-d-bugs mailing list