class Query(string queryText) { class Entity { void[] buf; class fld(T,string varName) { T opCall() { return cast(T)buf; } } } Entity e; } void main() { scope query = new Query!"SELECT ONLY_NEEDED_COLUMNS" "FROM contacts c" "WHERE c.country = 'US'" "AND c.sales > 10000;"; auto entity = query.e; //foreach(entity; query) //{ auto email_addy = entity.fld!(char,"email")(); } $ dmd test.d entity.(fld) Internal error: e2ir.c 688
Slightly more reduced: class Query(string queryText) { class Entity { void[] buf; class fld(T, string varName) { T opCall() { return cast(T)buf; } } } Entity e; } void main() { scope query = new Query!"SELECT ONLY_NEEDED_COLUMNS"; auto entity = query.e; auto email_addy = entity.fld!(char, "email")(); }
And more: class Entity { class fld() { char t; } } void main() { Entity entity; auto email_addy = entity.fld!().t; }
*** Issue 7701 has been marked as a duplicate of this issue. ***
It can be templated `class`, `struct`, or `union`, with function or field. Testcase from Issue 7701: --- struct S { struct S2 (T) { void fn () {} } } void main () { S s; s.S2!int.fn(); } --- Also now internal error is: e2ir.c 780
https://github.com/D-Programming-Language/dmd/pull/2818
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/54d6e35d46c7af02dbb718812834e084354c31b5 fix Issue 7645 - ICE(e2ir.c) nested classes https://github.com/D-Programming-Language/dmd/commit/346988f858702f958e559f7c28d4cb92f87e0eb7 Merge pull request #2818 from 9rnsr/fix7645 Issue 7645 - ICE(e2ir.c) nested classes
*** Issue 11621 has been marked as a duplicate of this issue. ***