www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8632] New: DMD accepts illegal template metaprogram


           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 puremagic.com
        ReportedBy: timon.gehr gmx.ch

--- Comment #0 from timon.gehr 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: -------
Sep 08 2012