[Issue 3031] scoped static var conflicts
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jul 27 06:11:38 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=3031
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|link-failure |
Summary|scoped static var conflicts |scoped static var conflicts
|while linking |
--- Comment #10 from Kenji Hara <k.hara.pg at gmail.com> ---
(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?
}
--
More information about the Digitalmars-d-bugs
mailing list