[Issue 6123] New: [CTFE] Cannot call a template member method inside delegate/function literal with -inline.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 8 00:52:26 PDT 2011


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

           Summary: [CTFE] Cannot call a template member method inside
                    delegate/function literal with -inline.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-06-08 00:47:55 PDT ---
Test case:

-------------------------
struct Bug6123(T) {
    void f() {}
    // can also trigger if the struct is normal but f is template
}
static assert({
    auto piece = Bug6123!int(); 
    piece.f();
    return true;
}());
-------------------------
Error: Cannot interpret &this at compile time
x.d(8): Error: cannot evaluate delegate bool()
{
Bug6123!(int) piece = Bug6123();
ref Bug6123!(int) this = piece;
 , assert(&this,"null this");
return true;
}
() at compile time
x.d(4): Error: static assert  (delegate bool()
{
Bug6123!(int) piece = Bug6123();
ref Bug6123!(int) this = piece;
 , assert(&this,"null this");
return true;
}
()) is not evaluatable at compile time
-------------------------

(Why that 'assert' is generated in CTFE anyway?)

-- 
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