D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6918 - Internal error: e2ir.c 1242
Summary: Internal error: e2ir.c 1242
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-09 02:37 UTC by Tobias Pankrath
Modified: 2012-06-24 14:29 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Tobias Pankrath 2011-11-09 02:37:54 UTC
I'd say, I found another compiler bug.

-----------------
import std.stdio;

template Struct(alias bar)
{
    struct S
    {
        void foo()
        {
            FancyFunc!(this, bar).fn();
        }
    }
}
template FancyFunc(alias context, alias f)
{
    void fn()
    {
        writeln("before");
        f(context);
        writeln("after");
    }
}
void bar(CT)(CT context)
{
    writeln(CT.stringof);
}
void main()
{
    alias Struct!(bar).S MyStruct;
    MyStruct s = MyStruct();
    s.foo();
}
----------------------

Compile it with dmd and dmd will print:

> Internal error: e2ir.c 1242
Comment 1 Trass3r 2011-11-09 05:44:48 UTC
Little bit simplified:

struct S(alias bar)
{
    void foo()
    {
        fn!(this, bar)();
    }
}
void fn(alias context, alias f)()
{
    f(context);
}
void bar(CT)(CT context)
{
}
void main()
{
    alias S!bar MyStruct;
}
Comment 2 Tobias Pankrath 2012-06-24 14:29:29 UTC
Seems to be fixed.