Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2001-07-14 06:29:44


>template<typename T> struct foo {
> template<typename U> struct bar : public foo<U> {};
>};

Thanks that works.

>I think it is the same MSVC bug as in the above ::template misparsing.
MSVC
>insists on finding a type (i.e. foo<U> or other<U>) but isn't satisfied by

>finding a template type parameter, so it crashes. For reference, Borland
>fails all of these testcases.

For some reason, I'm not seeing any problems with nested templates and
VC6sp3, or with VC7b1.

The following works just fine:

struct UDT1{};
struct UDT2{};

template<typename T>
struct foo
{
  template<typename U>
  struct bar : public foo<U>
  {};
};

template <class T>
void foo_test(T)
{
   typedef foo<T> foo_type;
   typedef typename foo_type::template bar<UDT2> bar_type;
   foo<T> ft;
   bar_type bt;
   (void)bt;
   (void)ft;
};

int test()
{
   foo_test(UDT1());
   return 0;
}

- John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/


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