May 23, 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@digitalmars.com
        ReportedBy: shro8822@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.


-- 

May 24, 2006
d-bugmail@puremagic.com schrieb am 2006-05-23:
> 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.

Added to DStress as http://dstress.kuehne.cn/nocompile/a/assert_15_A.d http://dstress.kuehne.cn/nocompile/a/assert_15_B.d http://dstress.kuehne.cn/nocompile/a/assert_15_C.d http://dstress.kuehne.cn/nocompile/a/assert_15_D.d

Thomas