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
Comment #1 by andrej.mitrovich — 2012-03-04T11:18:57Z
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")();
}
Comment #2 by hoganmeier — 2012-03-04T13:36:23Z
And more:
class Entity
{
class fld()
{
char t;
}
}
void main()
{
Entity entity;
auto email_addy = entity.fld!().t;
}
Comment #3 by verylonglogin.reg — 2013-10-14T03:17:49Z
*** Issue 7701 has been marked as a duplicate of this issue. ***
Comment #4 by verylonglogin.reg — 2013-10-14T03:18:06Z
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