[Bug 152] New: static assert fails with recursive templates
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue May 23 00:43:15 PDT 2006
    
    
  
http://d.puremagic.com/bugzilla/show_bug.cgi?id=152
           Summary: static assert fails with recursive templates
           Product: D
           Version: 0.157
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: shro8822 at uidaho.edu
This hangs until the stack overflows:
template hang(int i)
{
        static assert(0);
        const int hang = hang!(i-1);
}
const int x = hang!(1);
        This correctly asserts:
template hang()
{
        static assert(0);
        const int hang = hang!();
}
const int x = hang!();
        My guess is that the static assert is evaluated after the next hang!(i)
is evaluated (e.i. never) If a terminating case is added and a pragma(msg,"")
put in, only the terminating case gets the assert.
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list