Ok, here a sample app that gives Internal Error. Please notice that removing ~this() { } it seems to work.
struct Field(T) { }
struct Value
{
Field!T as(T)()
{
Field!T result;
return result;
}
~this(){ }
}
class Indexed
{
Value opIndex(T...)(T )
{
return Value();
}
}
class MyClass
{
void foo()
{
(new Indexed)["test"].as!int;
}
}
Comment #1 by briancschott — 2014-04-22T20:40:07Z
Another test case:
---------------------
alias CountsList = HashMap!(string, int);
void main()
{
CountsList[string] countsByOnet;
countsByOnet["1"] = CountsList(128);
}
struct HashMap(K, V)
{
this(this) {}
this(size_t) {}
~this() {}
}
Comment #2 by hsteoh — 2014-06-17T16:33:35Z
Possibly related: issue #12926
Comment #3 by yebblies — 2014-07-29T18:03:34Z
*** Issue 12926 has been marked as a duplicate of this issue. ***
Comment #4 by yebblies — 2014-07-29T18:17:41Z
Reduced:
struct NoDtor {}
struct HasDtor
{
NoDtor func()
{
return NoDtor();
}
~this() {}
}
void main()
{
HasDtor().func();
}
The glue layer tries to take the address of func's return, but doesn't use addressElem and just ends up making a mess. The backend ices because (OPaddr (OPcall ...)) is invalid.
https://github.com/D-Programming-Language/dmd/pull/3832
Comment #5 by bugzilla — 2014-08-19T20:41:37Z
*** This issue has been marked as a duplicate of issue 13303 ***