Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-03-05 07:01:00


David Abrahams wrote:
> I was just getting ready to propose a new config macro called
> BOOST_ARG_DEPENDENT_TYPENAME based on this test:
>
> struct id { typedef int type; };
>
> template <class T> struct foo;
>
> template <class T>
> void f(T)
> {
> typedef foo<typename T::type> y;
> }
>
> int main()
> {
> f(id());
> return 0;
> }
>
> But it turns out that this test is very similar to the one for
> BOOST_DEDUCED_TYPENAME, and in fact it finds the same compiler (VC6).
> So I guess the question is, do we currently have the right name for
> the test and macro?

If BOOST_DEDUCED_TYPENAME was introduced for the sake of MSVC only (which
seems very likely to be the case), then it was given a wrong name, since
there are lots of other situations, besides the "deduced typename" context,
when the compiler refuses to accept 'typename', incorrectly - in particular,
the one demonstrated by the above test case. Classifying those situations
and introducing a separate macro for each and every of them just isn't worth
the troubles, in particular because MSVC is the only compiler with such
peculiarity with respect to 'typename' in different contexts; IMO what is
needed in place of such artificial classification is a single macro that
explicitly documents that what is being worked around here is a weird
behavior of one particular compiler, e.g. BOOST_MSVC_TYPENAME or something
like it.

Aleksey


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