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

Kenji Hara <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|link-failure                |
            Summary|scoped static var conflicts |scoped static var conflicts
                   |while linking               |

--- Comment #10 from Kenji Hara <[email protected]> ---
(In reply to Mathias LANG from comment #9)
> Nowadays it gives the following error:
> 
> test.d(14): Error: declaration test.func.j is already defined in another
> scope in func
> 
> Since https://issues.dlang.org/show_bug.cgi?id=11720 was 'fixed'.

So now, the test case won't cause link-failure. Updated summary and keywords.

If the static variables are in extern(D) function, they can have unique mangled
names.

But, if they're not in extern(D) function, or does not have extenr(D) linkage,
they might conflict. For example:

extern(C++) foo()
{
    { extern(C++) static int var; pragma(msg, var.mangleof); }
    { extern(C++) static int var; pragma(msg, var.mangleof); }  // disallowed?
}

--

Reply via email to