Bug or not? Statics inside blocks
Cecil Ward via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jul 28 18:57:02 PDT 2017
On Saturday, 29 July 2017 at 01:54:29 UTC, Cecil Ward wrote:
> The snippet below failed to compile (I think) in the latest DMD
> - but I can't see the error message in the web-based editor at
> dlang.org. It certainly failed to compile under GDC 5.2.0 when
> tried out using d.godbolt.org. (Is there any chance of a later
> GDC compiler there?)
>
> Is it my bug, or a compiler bug? (name clash at link-time?):
>
> void main()
> {
> {
> immutable static dstring str1 = "a";
> }
> {
> immutable static dstring str1 = "b";
> }
> }
Workaround is just to rename one, assuming that avoids a name
clash at <xx?phase>-time.
More information about the Digitalmars-d-learn
mailing list