From: David Abrahams (dave_at_[hidden])
Date: 2003-02-23 17:09:35
"Andreas Huber" <ah2003_at_[hidden]> writes:
> Hi Aleksey & all other metaprogramming gurus
> The attached code compiles just fine with MSVC7.1 but MSVC7.0 once more has
> its problems. This time I'm quite sure it has nothing to do with MPL,
> instead VC7.0 seems to get confused and reports the following:
> d:\Data\StopWatch\StopWatch.cpp(58) : error C2516:
> 'state_base_type<Derived,Context,Transitions,InnerInitial>::type' : is not a
> legal base class
> According to the docs this error is reported when you try to inherit from
> built-in types like int.
> If you then remove the 3 first characters of the lines marked with // ***
> here ***, the program compiles and you can see in the debugger that the
> result returned by the metafunction state_base_type is quite a legal base
> class (see type of pWhatever).
> Has anyone else ever encountered similar problems with either 7.0 or 6.5?
> Are there any workarounds?
This looks seriously like ETI (early template instantiation) again.
Unfortunately I'm not sure exactly what the fix is; Aleksey is the
only person I know who really understands how to work around this.
One thing you could try:
template< class Derived,
class Transitions = empty_list,
class InnerInitial = empty_list >
: public mpl::identity< // Here
Derived, Context, Transitions, InnerInitial >::type
>::type // Here
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk