Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-05-21 08:20:57

"Arkadiy Vertleyb" <vertleyb_at_[hidden]> wrote in message

> "David Abrahams" <dave_at_[hidden]> wrote
> > Unfortunately there are still problems with vc-8:
> >
> > ..\..\..\..\boost/sequence/detail/typeof_add.hpp(15) : error C2893:
> to specialize function template 'char (&boost::type_of::size(const T
> '
> > With the following template arguments:
> > 'T'
> > ..\..\..\..\boost/sequence/detail/typeof_add.hpp(16) : see
> reference to class template instantiation
> 'boost::sequence::detail::typeof_add<T,U>' being compiled
> >
> > See the updated archive.
> I've run into this problem before. Looks like it's present only in vc8
> beta. Seems to be "fixed" if make<T>() is replaced with T() -- of course
> then we have problems with non-default-constructible classes. *(T*)0
> doesn't work either.
> Doesn't look like a Typeof problem, although Typeof may be responsible for
> driving the compiler crazy, after which it chokes.
> Seems to be a question to Microsoft...

After looking at this more closely, I believe the problem can't always be
"cured" in the way I suggested. Also it can be reproduced on both vc71 and
vc8 beta. Here is the minimal example:

// ----
#include "boost/mpl/vector.hpp"
#include "boost/mpl/size_t.hpp"

template<class T> T make();

template<class T>
struct et
    typedef boost::mpl::vector1<int> type;

template<class T>
char(&sz(const T&))[
        typename et<T>::type

template<class T, class U>
struct add
    typedef boost::mpl::vector1<
        boost::mpl::size_t<sizeof(sz(make<T>() + make<U>()))>
        //boost::mpl::size_t<sizeof(sz(T() + U()))> -- doesn't help here
> type;

int main()
    return 0;
// ----

This example compiles fine with GCC, but both MS compilers choke on it.

OTOH, our ODR test uses BOOST_TYPEOF_TPL(T() + U()) in a few different
contexts, and it works fine on both MS compilers.

Do Microsoft people read this list, or should I post it elsewhere?


Boost list run by bdawes at, gregod at, cpdaniel at, john at