size_t fac(size_t n) { size_t res = n; while (n--) res *= n; return res; } static assert(fac(3) == 6); ------
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); > > ------
Oops.