Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2003-02-04 07:29:44


Hi,

Borland cannot handle this code:

#include <boost/type_traits.hpp>
#include <boost/mpl/if.hpp>

using namespace boost;
using namespace boost::mpl;

struct A {};
struct B {};

template <typename T>
struct C : if_<is_empty<T>, A, B>::type {};

struct D { int i; };
struct E {};

struct F : C<D> {};
struct G : C<E> {};

Is there a known workaround? Can this be fixed?
I keep on bumping into this problem and its variants.
Or is there a better MPL idiom?

TIA,
Joel de Guzman
joel_at_[hidden]
http://www.boost-consulting.com

<errors follow>

Borland 5.5.1 [no STLport]
C:\dev\mpl_if.cpp:
Error E2396 C:\dev\boost\boost/type_traits/is_convertible.hpp 190: Template argument must be a
constant expression
Error E2299 C:\dev\boost\boost/type_traits/is_convertible.hpp 190: Cannot generate template
specialization from 'type_traits::ice_and<b1,b2,b3,b4,b5,b6,b7>'
Error E2293 C:\dev\boost\boost/type_traits/is_convertible.hpp 190: ) expected
Error E2230 C:\dev\boost\boost/type_traits/is_convertible.hpp 190: In-line data member
initialization requires an integral constant expression
Error E2230 C:\dev\boost\boost/mpl/bool_c.hpp 27: In-line data member initialization requires an
integral constant expression
Error E2029 C:\dev\boost\boost/type_traits/is_convertible.hpp 195: 'bool_c<&value>' must be a
previously defined class or struct
Error E2451 C:\dev\boost\boost/type_traits/is_empty.hpp 109: Undefined symbol 'value'
Error E2401 C:\dev\boost\boost/type_traits/is_empty.hpp 109: Invalid template argument list
Error E2299 C:\dev\boost\boost/type_traits/is_empty.hpp 109: Cannot generate template specialization
from 'type_traits::ice_or<b1,b2,b3,b4,b5,b6,b7>'
Error E2293 C:\dev\boost\boost/type_traits/is_empty.hpp 109: ) expected
Error E2230 C:\dev\boost\boost/type_traits/is_empty.hpp 109: In-line data member initialization
requires an integral constant expression
Error E2029 C:\dev\boost\boost/type_traits/is_empty.hpp 193: 'bool_c<&value>' must be a previously
defined class or struct
Error E2029 C:\dev\boost\boost/mpl/aux_/value_wknd.hpp 30: 'is_empty<D>' must be a previously
defined class or struct
Error E2407 C:\dev\boost\boost/mpl/if.hpp 62: Dependent type qualifier 'aux::value_wknd<is_empty<D>
>' has no member symbol named 'value'
Error E2407 C:\dev\boost\boost/mpl/if.hpp 62: Dependent type qualifier 'aux::value_wknd<is_empty<D>
>' has no member symbol named 'value'
Error E2407 C:\dev\boost\boost/mpl/if.hpp 65: Dependent type qualifier 'aux::value_wknd<is_empty<D>
>' has no member symbol named 'value'
Error E2407 C:\dev\boost\boost/mpl/if.hpp 65: Dependent type qualifier 'aux::value_wknd<is_empty<D>
>' has no member symbol named 'value'
Error E2402 C:\dev\mpl_if.cpp 11: Illegal base class type: formal type 'typename
if_<is_empty<T>,A,B>::type' resolves to 'typename if_c<,A,B>::type'
Error E2029 C:\dev\mpl_if.cpp 16: 'C<D>' must be a previously defined class or struct
Error E2396 C:\dev\boost\boost/type_traits/is_convertible.hpp 190: Template argument must be a
constant expression
Error E2299 C:\dev\boost\boost/type_traits/is_convertible.hpp 190: Cannot generate template
specialization from 'type_traits::ice_and<b1,b2,b3,b4,b5,b6,b7>'
Error E2293 C:\dev\boost\boost/type_traits/is_convertible.hpp 190: ) expected
Error E2230 C:\dev\boost\boost/type_traits/is_convertible.hpp 190: In-line data member
initialization requires an integral constant expression
Error E2029 C:\dev\boost\boost/type_traits/is_convertible.hpp 195: 'bool_c<&value>' must be a
previously defined class or struct
Error E2451 C:\dev\boost\boost/type_traits/is_empty.hpp 109: Undefined symbol 'value'
Error E2228 C:\dev\boost\boost/type_traits/is_empty.hpp 109: Too many error or warning messages
*** 26 errors in Compile ***


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk