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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 11 03:42:26 PST 2013


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



--- Comment #6 from Max Samukha <samukha at voliacable.com> 2013-12-11 03:42:16 PST ---
(In reply to comment #5)
> Looks like a design mistake.

FWIW, C++ seems to do a sane thing. Class decls do not conflict and the
assertion passes:

int main(int argc, char *argv[])
{
    int *x1;
    int *x2;

    {
        class C
        {
        };

        static int x;
        x1 = &x;
    }
    {
        class C
        {
        };

        static int x;
        x2 = &x;
    }

    assert(x1 != x2);
}

-- 
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