[Issue 1461] New: Local variable as template alias parameter breaks CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 31 07:25:05 PDT 2007


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

           Summary: Local variable as template alias parameter breaks CTFE
           Product: D
           Version: 2.003
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: reiner.pope at gmail.com


The following code fails to compile with error, "cannot evaluate generate() at
compile time." This error is stopped by declaring x in global scope.

void main()
{
    int x;
    const string text = Gen!(x).generate();
}

template Gen(alias A)
{
    string generate()
    {
        return null;
    }
}


-- 



More information about the Digitalmars-d-bugs mailing list