[Issue 10084] ICE(toir.c) alias template parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 16 04:38:22 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=10084


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> 2013-11-16 04:38:18 PST ---
Make the OP code more readable.

void callFunc(T, alias func)() {
  void call(Member)() {
    func!Member();
  }
  call!T;
}
template Mix() {
  void save() {
    void saveImpl(Member)() {
    }
    callFunc!(typeof(this), saveImpl);
  }
}
struct S {
  mixin Mix;
}

With 2.064, the code doesn't occur ICE. Instead following errors printed:

test.d(3): Error: function test.callFunc!(S, saveImpl).callFunc.call!(S).call
cannot access frame of function test.S.Mix!().save
test.d(5): Error: template instance test.callFunc!(S,
saveImpl).callFunc.call!(S) error instantiating
test.d(12):        instantiated from here: callFunc!(S, saveImpl)
test.d(12): Error: template instance test.callFunc!(S, saveImpl) error
instantiating

However compiler should accept the code. All of template functions instantiated
in save() -
  callFunc!(S, saveImpl),
  callFunc!(S, saveImpl).call!T == callFunc!(S, saveImpl).call!Member
  callFunc!(S, saveImpl).call!T.func!Member == save.saveImpl!Member
should capture the frame pointer of save() member function.

https://github.com/D-Programming-Language/dmd/pull/2780

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


More information about the Digitalmars-d-bugs mailing list