Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2007-05-14 08:40:19


2007/5/14, Vertleyb <vertleyb_at_[hidden]>:
> From: "John Femiani" <JOHN.FEMIANI_at_[hidden]>
>
> > I wrote a little macro that uses BOOST_TYPEOF to determine the type of
> > one of its arguments, but it fails when I pass (*this) as an argument in
> > vc8. I forced emulation because, according to the docs, vc8 does not
> > seem to have the bug that let other vc compilers actually support native
> > typeof. I don't know the internals of the TYPEOF library well enough
> > to diagnose the problem, but the error is easy to produce.
> >[...]
> > If there is any way to accomplish the type of access I am attempting
> > from inside a macro I would really appreciate it (in my use case macros
> > seem to be absolutely necessary for other reasons). As you can see from
> > the example it is possible to avoid the problem by creating a reference
> > to *this and passing that, but I do not like this in principle because
> > too many caveats make the macro difficult to use.
>
> I think this problem is not related to the usage inside a macro. It looks like MSVC can't handle "this" inside BOOST_TYPEOF() in
> general :-( At some point the compiler gets confused, and thinks that "this" is used outside a member function...
>
> The "native" usage for vc8 is available in CVS, but unfortunately it will not help with this issue.

The following simple code replicates the problem on VC8.0
template<int a>
struct sizer {
};

class test {
public:
    void tester() {
        sizer<sizeof(*this)> a;
    }
};

void main()
{
}

By modifying BOOST_TYPEOF_NESTED_TYPEDEF to eliminate local class
templates, I was able to handle "this" inside
BOOST_TYPEOF_NESTED_TYPEDEF on this compiler.

This fix is trivial, but the problem is that a similar fix for the
emulation version of BOOST_TYPEOF_NESTED_TYPEDEF would reimpose the
strict limitation that the complexity of the encoded type can not
increase BOOST_TYPEOF_LIMIT_SIZE...

Regards,
Peder

>
> Regards,
> Arkadiy
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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