Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2007-05-24 10:00:17


On 5/24/07, Arkadiy Vertleyb <vertleyb_at_[hidden]> wrote:
> "Giovanni Piero Deretta" <gpderetta_at_[hidden]> wrote
>
> > This works though (at least with gcc 4.1.2):
> >
> > #include <vector>
> >
> > template<typename T>
> > struct identity {
> > typedef T type;
> > };
> >
> > int main() {
> > std::vector<int> v;
> > typedef identity<typeof(v)>::type::iterator type;
> > }
> >
> > So BOOST_TYPEOF could include 'identity' in its expansion.
>
> Working around the problem by _complicating_ the expression inside typeof is
> not a way I would go. It then may fail in another contexts, where it didn't
> fail before.
>

Agreed, In fact I said myself that the 'simple' solution could break
with more complex expressions.

> This is clearly a compiler bug, and needs to be addressed by the compiler
> developers.
>

Well, boost as plenty of workarounds for broken compilers, so I do not
think this matter much. Even if gcc developers fixthis, older releases
will be still broken.

Anyways, IIRC next release might support decltype, so the issue is moot.

gpd


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