Bug 11843 – Template instantiated twice: failed semantic analysis

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-29T19:42:00Z
Last change time
2013-12-30T07:03:00Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
dransic

Comments

Comment #0 by dransic — 2013-12-29T19:42:21Z
I thought this would be issue #11767, but the error is still there with this code: --- struct Foo { int x[string]; } struct Bar(alias foo) {} // line 6 enum bar1 = Bar!(Foo(["a": 1]))(); enum bar2 = Bar!(Foo(["a": 1]))(); // line 9 void main() {} --- bug.d(6): Error: struct test.Bar!(Foo(["a":1])).Bar failed semantic analysis bug.d(9): Error: template instance test.Bar!(Foo(["a":1])) error instantiating
Comment #1 by k.hara.pg — 2013-12-30T00:50:54Z
Comment #2 by dransic — 2013-12-30T03:48:06Z
(In reply to comment #1) > https://github.com/D-Programming-Language/dmd/pull/3049 I have tested your patch, but now bar1 and bar2 have the same type even if instantiated with two different symbol aliases. --- void main() { struct Foo { int x[string]; } struct Bar(alias foo) {} enum foo1 = Foo(["a": 1]); enum foo2 = Foo(["b": -1]); static assert(!__traits(isSame, foo1, foo2)); enum bar1 = Bar!foo1(); enum bar2 = Bar!foo2(); static assert(is(typeof(bar1) == typeof(bar2))); } ---
Comment #3 by github-bugzilla — 2013-12-30T06:22:42Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/21b8a4ad6f567fdec97ec4bd1894d9385576269b fix Issue 11843 - Template instantiated twice: failed semantic analysis https://github.com/D-Programming-Language/dmd/commit/511b084ecca32f75bd70ea9f7458a466e4ab04ca Merge pull request #3049 from 9rnsr/fix11843 Issue 11843 - Template instantiated twice: failed semantic analysis