www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11053] New: Regression (2.064 git-head): Recursive template expansion error with -unittest switch

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053

           Summary: Regression (2.064 git-head): Recursive template
                    expansion error with -unittest switch
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-16
13:50:33 PDT ---
-----
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
-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 16 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-16
13:51:56 PDT ---
Seems to be caused by:

commit a5086fa49c5cd236297584c07e03be8e52208158
Merge: bc9e500 539d809
Author: Hara Kenji <k.hara.pg+dev gmail.com>
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-16
13:54:44 PDT ---
(In reply to comment #1)
 Seems to be caused by:
 
 commit a5086fa49c5cd236297584c07e03be8e52208158
 Merge: bc9e500 539d809
 Author: Hara Kenji <k.hara.pg+dev gmail.com>
 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-16
13:56:49 PDT ---
I'm testing this with various DMD commits, but I think this may be a
Phobos-introduced bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-16
13:58:32 PDT ---
Got it:

Phobos commit 0b6ceaa:

commit 0b6ceaa5aaef1b38a2e4bb2bfe5c3b4dab60aaa9
Merge: b0d11ad 5939a04
Author: monarch dodra <monarchdodra gmail.com>
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053



--- Comment #5 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-16
14:01:57 PDT ---
See my comments here for the offending Phobos lines:
https://github.com/D-Programming-Language/phobos/pull/1561/files#r6389254

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-16
14:07:19 PDT ---
Fixup pull:

https://github.com/D-Programming-Language/phobos/pull/1580

I still think we've uncovered a compiler issue though.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053



--- Comment #7 from github-bugzilla puremagic.com 2013-09-17 00:34:49 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Phobos                      |DMD
         AssignedTo|andrej.mitrovich gmail.com  |nobody puremagic.com
            Summary|Regression (2.064           |Regression (2.064
                   |git-head): Recursive        |git-head): Recursive
                   |template expansion error    |template expansion error
                   |with -unittest switch       |


--- Comment #8 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-17
04:17:37 PDT ---
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(" ");
}
-----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11053


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Regression (2.064           |Recursive template
                   |git-head): Recursive        |expansion error
                   |template expansion error    |
           Severity|regression                  |normal


--- Comment #9 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-17
04:24:17 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2013