Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-07-28 22:03:42


Hi everybody,

I modified the code to automatically generate IDs of registration groups.
The registration now is as simple as:

#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()

BOOST_TYPEOF_REGISTER_TYPE(...);
BOOST_TYPEOF_REGISTER_TEMPLATE(...);
...

I also added some tests that should cause the ODR violation (see odr.hpp,
odr1.cpp, odr2.cpp). VC7.1 is fine with them, however I can't make GCC 3.3
to compile this, and it stops much before the ODR could be diagnosed. Looks
like this compiler totally can't handle the case when I try to use typeof
(native or not) inside a template.

When I force the typeof emulation, I am getting:

"sorry, unimplemented: `method_call_expr' not supported by dump_expr"

on every attempt to use my encoding/decoding stuff inside a template. From
searching the web it looks like this is some kind of known bug related to
improper handeling of sizeof(). Since sizeof() is the central part of all
this, I don't really know how to work it around...

This would probably be OK, since GCC has the native typeof support.
However, when I use the native support, I run into a different problem that
can be illustrated by the following code:

template<class T, class U>
typeof(T() + U()) sum(const T& t, const U& u)
{
        return t + u;
}

main()
{
        sum(5, 3.14); // this is line 9
        return 0;
}

The compile of this code fails with following message:

a.cpp:9: internal compiler error: in write_type, at cp/mangle.c:1555

GCC appears to be fine when the native typeof is used inside _class_
templates, though.

I would really appreciate if anybody shed some light on any of these
problems...

The code is in the Spirit CVS and at:
http://groups.yahoo.com/group/boost/files/typeof.zip

Again, eveything is working fine in VC7.1. If anybody could try any other
compiler (to build main.cpp, odr1.cpp, and odr2.cpp together), I would
really appreciate this.

Thanks,
Arkadiy


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