[Issue 7694] Internal error: e2ir.c 1251 when calling member function inside struct via alias param

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 23 22:49:58 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7694



--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2012-03-23 22:50:19 PDT ---
(In reply to comment #0)
> As is the following gives assert on line 8 as expected, 
> uncomment bootstrap to get Internal error: e2ir.c 1251
> 
> template Instruction(int ir)
> {
>     void match(alias s, alias  m)(){ m.nextState(); }
> }
> 
> 
> struct T{
>     void nextState(){  assert(0); }
> /*    void bootstrap()
>     {
>     return Instruction!(0).match!(this, this)();
>     }*/
> }
> 
> T t;
> void main()
> {
> 
> //  t.bootstrap();
>   Instruction!(0).match!(t, t)();
> }

With my pull, this code doesn't report ice, but raises following errors:

test.d(11): Error: template instance match!(this,this) cannot use local 'this'
as parameter to non-global template match(alias s,alias m)
test.d(11): Error: template instance match!(this,this) cannot use local 'this'
as parameter to non-global template match(alias s,alias m)

But I think this is a little harsh error. The nested template (function) match
in module template Instruction really needs only one context, that is enclosing
'this' given as alias parameters m and n.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list