[Issue 6965] [CTFE] wrong reset of variable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 18 13:08:31 PST 2011


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug at yahoo.com.au
         Resolution|                            |INVALID


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2011-11-18 13:07:40 PST ---
That fails at run time, too. You're multiplying by zero!
Should be:   while(--n)

(In reply to comment #0)
> size_t fac(size_t n)
> {
>     size_t res = n;
>     while (n--)
>         res *= n;
>     return res;
> }
> 
> static assert(fac(3) == 6);
> 
> ------

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