Bug 11053 – Recursive template expansion error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-16T13:50:33Z
Last change time
2018-01-08T14:56:01Z
Keywords
pull
Assigned to
No Owner
Creator
Andrej Mitrovic

Comments

Comment #0 by andrej.mitrovich — 2013-09-16T13:50:33Z
----- import std.string; enum E : string { a = "a", b = "b" } void main() { auto x = [E.a, E.b].join(" "); } ----- $ dmd -unittest test.d > C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\array.d(2233): > Error: template instance std.array.Appender!string.Appender.canPutItem!(E) > recursive expansion
Comment #1 by andrej.mitrovich — 2013-09-16T13:51:56Z
Seems to be caused by: commit a5086fa49c5cd236297584c07e03be8e52208158 Merge: bc9e500 539d809 Author: Hara Kenji <[email protected]> Date: Sun Sep 15 17:38:33 2013 -0700 Merge pull request #2537 from WalterBright/fix-pull-2441 fix pull #2441 https://github.com/D-Programming-Language/dmd/pull/2537
Comment #2 by andrej.mitrovich — 2013-09-16T13:54:44Z
(In reply to comment #1) > Seems to be caused by: > > commit a5086fa49c5cd236297584c07e03be8e52208158 > Merge: bc9e500 539d809 > Author: Hara Kenji <[email protected]> > Date: Sun Sep 15 17:38:33 2013 -0700 > > Merge pull request #2537 from WalterBright/fix-pull-2441 > > fix pull #2441 > > https://github.com/D-Programming-Language/dmd/pull/2537 Woops nevermind, I reduced it wrong apparently, sorry! That pull didn't look like the faulting one anyway.
Comment #3 by andrej.mitrovich — 2013-09-16T13:56:49Z
I'm testing this with various DMD commits, but I think this may be a Phobos-introduced bug.
Comment #4 by andrej.mitrovich — 2013-09-16T13:58:32Z
Got it: Phobos commit 0b6ceaa: commit 0b6ceaa5aaef1b38a2e4bb2bfe5c3b4dab60aaa9 Merge: b0d11ad 5939a04 Author: monarch dodra <[email protected]> Date: Sat Sep 14 13:49:24 2013 -0700 Merge pull request #1561 from tom-tan/fix-unittest-array-assocArray Fix unittest for std.array.assocArray Checkout out one before it works.
Comment #5 by andrej.mitrovich — 2013-09-16T14:01:57Z
See my comments here for the offending Phobos lines: https://github.com/D-Programming-Language/phobos/pull/1561/files#r6389254
Comment #6 by andrej.mitrovich — 2013-09-16T14:07:19Z
Fixup pull: https://github.com/D-Programming-Language/phobos/pull/1580 I still think we've uncovered a compiler issue though.
Comment #7 by github-bugzilla — 2013-09-17T00:34:49Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/7494ef15c19359454a919114005fca6ab783e37d Implement workaround for regression - Fix Issue 11053. https://github.com/D-Programming-Language/phobos/commit/8e926a6e4004832b257b39bcd3c2ac8e95a3faf2 Merge pull request #1580 from AndrejMitrovic/WorkAround1561 Implement workaround for regression - Fix Issue 11053.
Comment #8 by andrej.mitrovich — 2013-09-17T04:17:37Z
Labeled it as a DMD bug, and without the need for -unittest. Reduced test-case: ----- import std.string; import std.typecons; static assert(!__traits(compiles, [ tuple("foo", "bar", "baz") ].assocArray())); enum E : string { a = "a", b = "b" } void main() { auto x = [E.a, E.b].join(" "); } -----
Comment #9 by andrej.mitrovich — 2013-09-17T04:24:17Z
Update: Not a git-head regression, 2.063.2 also has the same error with the reduced test-case (http://d.puremagic.com/issues/show_bug.cgi?id=11053#c8). With 2.062 the '.join' call fails to instantiate, so I can't reproduce the same error.
Comment #10 by razvan.nitu1305 — 2018-01-08T13:55:01Z
Should we close this?
Comment #11 by simen.kjaras — 2018-01-08T14:56:01Z
The original error is gone, so yes. The code doesn't compile now either, but it's arguable whether that's a bug, and it should be treated as a separate issue if so.