www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: kennytm gmail.com



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: -------
Jun 08 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6123


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED



Fixed by implementing pointers in CTFE.

https://github.com/D-Programming-Language/dmd/commit/846aa2683ec63c364e72281c4c655387806558e2

D1 fix:

https://github.com/D-Programming-Language/dmd/commit/16c9700caab0bece92212c5e1a52b323258d7633

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