Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2004-07-27 08:17:59


Michael Stevens ha escrito:

> On Tuesday 27 July 2004 00:42, JOAQUIN LOPEZ MU?Z <joaquin_at_[hidden]> wrote:
>
> > error C2888: 'void
> boost::multi_index::safe_mode::detach_equivalent_iterators(Iterator &)' :
> symbol cannot be defined within namespace 'detail'
>
> The error seems to indicate a namespace problem rather then something specific
> to member template friends?
>

I don't think so. My hunch is that the problem is template-specific.
The following test snippet works OK with MSVC 6.5 and Comeau 4.3.3.
I guess MSVC 8.0 will handle it right too since MSVC 6.5 does, but I
cannot verify this hypothesis:

****************TEST 0****************
namespace A{

namespace C{
  class foo;
}

namespace B{
  void f(C::foo& x);
}

namespace C{
  class foo
  {
    int m;
    friend void B::f(foo&);
  };
}

namespace B{
  void f(C::foo& x)
  {
    x.m=0;
  }
}

} // A

int main()
{
  A::C::foo x;
  A::B::f(x);

  return 0;
}

****************END TEST 0****************

When we introduce templates, Comeau still has it right, but
MSVC 6.5 chokes on it (error C2888, the same that
RudbekAssociates tests show for multi_index in VC 8.0):

****************TEST 1****************
namespace A{

namespace B{
  template<typename X>void f(X& x)
  {
    x.m=0;
  }
}

namespace C{
  class foo
  {
    int m;
    template<typename X> friend void B::f(X&);
  };
}

} // A

int main()
{
  A::C::foo x;
  A::B::f(x);

  return 0;
}

****************END TEST 1****************

Could some kind soul with access to MSVC 8.0 try TEST 0 and TEST 1 for
this compiler and report the results? If TEST 0 passes and TEST 1 fails, IMHO
BOOST_NO_MEMBER_TEMPLATE_FRIENDS should be set on for this
compiler, or at least a weak variant, something like
BOOST_NO_MEMBER_TEMPLATES_ACROSS_NAMESPACES

Thanks,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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