D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7851 - Internal error: e2ir.c 688
Summary: Internal error: e2ir.c 688
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: ice
Depends on:
Blocks:
 
Reported: 2012-04-07 12:22 UTC by Caligo
Modified: 2012-05-15 23:09 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Caligo 2012-04-07 12:22:10 UTC
DMD 2.059beta (not head), on a 64-bit GNU/Linux

---------------->8---------------->8----------------
import std.typecons;
import std.stdio;

void main() {
  alias Tuple!(int, long, float) TL;
  foreach (i, T; TL)
    writefln("TL[%d] = ", i, typeid(T));
}
----------------8<----------------8<----------------

I get:
_field_field_0
Internal error: e2ir.c 688

source (under the section 'Looping'):
http://dlang.org/tuple.html

The code in that section is also wrong and doesn't compile.  The following gives the correct output:

---------------->8---------------->8----------------
import std.typecons;
import std.typetuple;
import std.stdio;


void main() {
  Tuple!(int, long, float) TL;
  foreach (i, T; TL)
    writefln("TL[%d] = %s", i, typeid(T));

  alias TypeTuple!(3, 7L, 6.8) ET;
  foreach (i, E; ET)
    writefln("ET[%d] = %s", i, E);
----------------8<----------------8<----------------
Comment 1 Robert Clipsham 2012-05-02 08:28:48 UTC
This is a regression (an error was issued in 2.057, the ICE was introduced in 2.058).
Comment 2 Don 2012-05-14 01:07:26 UTC
Maybe this is bug 7851?
(Which would make this a Phobos regression, even though it's a compiler bug)
Comment 3 Walter Bright 2012-05-15 22:34:41 UTC
This reduces to:

template TypeTuple(TList...)
{
    alias TList TypeTuple;
}

struct Tuple(Specs...)
{
    TypeTuple!(int, long, float) mem;

    alias Identity!(mem[0]) _0;
    alias Identity!(mem[1]) _1;
    alias Identity!(mem[2]) _2;

    alias mem this;

    enum length = mem.length;
}

private template Identity(alias T)
{
    alias T Identity;
}

void main() {
  alias Tuple!(int, long, float) TL;
  foreach (i; TL)
  { }
}
Comment 4 github-bugzilla 2012-05-15 23:07:51 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7e3a2205fca61512dd4245b939d4f7b4e7334419
fix Issue 7851 - Internal error: e2ir.c 688
Comment 5 github-bugzilla 2012-05-15 23:08:01 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/cc8389aa19471499b25abf85e39d55f884b0bc85
fix Issue 7851 - Internal error: e2ir.c 688