Bug 12727 – [REG2.066a] DMD hangs up on recursive alias declaration

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-10T08:03:00Z
Last change time
2014-05-13T00:32:52Z
Keywords
ice, pull
Assigned to
nobody
Creator
temtaime

Comments

Comment #0 by temtaime — 2014-05-10T08:03:20Z
template IndexTuple(int e, int s = 0, T...) { static if(s == e) alias IndexTuple = T; else alias IndexTuple = IndexTuple!(e); } struct LUP(T, int N) { alias MT = Matrix!(T, N); MT lu ; } struct Matrix(T, uint N = M) { union { T[]A ; } pure decomposeLUP() { auto r = LUP!(T, N); foreach(j; IndexTuple!(1)) { foreach(i; IndexTuple!(N)) r.lu[i][j] /= r.lu[j][j]; foreach(k; IndexTuple!(N, j + 1)) r.lu[i][k] -= r.lu[i][j] * r.lu[j][k]; } } } alias Vector(T, uint M) = Matrix!(T, M); alias Vector3 = Vector!(float, 3); Dustmited should give compile error.
Comment #1 by temtaime — 2014-05-10T08:03:59Z
No hang on 065.So it's reg.
Comment #2 by dlang-bugzilla — 2014-05-10T08:11:04Z
This is a regression. DMD 2.065 produces error messages and exits. DMD git overflows the stack.
Comment #3 by dlang-bugzilla — 2014-05-10T08:13:31Z
Comment #4 by k.hara.pg — 2014-05-12T16:32:20Z
Comment #5 by github-bugzilla — 2014-05-13T00:32:51Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/fbd78c3db2c2c03ec098c1b433431d7f3f144ef7 fix Issue 12727 - DMD hangs up on recursive alias declaration By the commit fd1762c33ac034ad3112e69f21421b5c75b3cc6c, now static-if declaration does nothing in `addMembers` phase, and conditional eponymous template instance cannot raise "recursive alias declaration" error in `TemplateInstance::semantic`, because `TemplateInstance::aliasdecl` is not set until the end of it. By looking for circular aliasing not only in `AliasDeclaration::semantic` but also in `AliasDeclaration::toAlias`, we can defer the detection until appropriate timing. https://github.com/D-Programming-Language/dmd/commit/402efb34eba5e45f20a1b05850eac3647f6e635c Merge pull request #3545 from 9rnsr/fix12727 [REG2.066a] Issue 12727 - DMD hangs up on recursive alias declaration