Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2006-04-05 18:42:32


Kiuhnm <kiuhnm03_at_[hidden]> writes:

> I'm using MSVC8 (2005) with Boost 1.33.1.
> The code at the end of this post should cause the compiler to print out
> something like this (GCC):
>
> conversion from 'mpl_::failed
> ****************(factorial<mpl_::int_<-5>
> >::FACTORIAL_of_NEGATIVE_NUMBER::****************)
> (mpl_::int_<-5>)' to non-scalar type 'mpl_::assert<false>'
> requested.
>
> but I obtain something completely different.
> It seems that the compiler continues to evaluate the factorial (-1, -2, -3,
> ...) ignoring the assertions. Since the template expansion is quite
> "complex", the compiler fails and prints out:
>
> ---
> fatal error C1202: recursive type or function dependency context too complex
>
> c:\boost\include\boost-1_33_1\boost\mpl\aux_\preprocessed\plain\times.hpp(60)
> : see reference to class template instantiation 'factorial<N>' being
> compiled
> with
> [
> N=boost::mpl::int_<-88>
> ]
> ---
>
> What's wrong?

The details of how a compiler does template instantiation are
implementation-dependent. It may be instantiating all the base
classes before instantiating all the bodies. Try not using
metafunction forwarding.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net