[Issue 8632] New: DMD accepts illegal template metaprogram

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 8 15:00:45 PDT 2012


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

           Summary: DMD accepts illegal template metaprogram
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2012-09-08 15:01:25 PDT ---
DMD 2.060:
template BrokenY(alias F){
    template BrokenY(A...){
        template Z(alias X){
            alias F!(X,A) Z;
        }
        alias Z!Z BrokenY;
    }
}
template AlmostFact(alias BrokenFact, int n){
    static if(n) enum AlmostFact = n*BrokenFact!(n-1);
    else enum AlmostFact=1;
}
alias BrokenY!AlmostFact BrokenFact;
pragma(msg, BrokenFact!3); // "36"

DMD accepts this code, but it is invalid. It seems to be some kind of lookup
problem. Consistently renaming one of the two BrokenFact aliases makes the
problem disappear.

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