Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-03-01 05:36:41


Hi there,

while porting the format library to MSVC6 and STLport I encountered the following compiler bug:

namespace A {
  template<class T> struct foo{};
}
namespace B {
  using A::foo;
}
B::foo<int> bar; // error C2143: syntax error : missing ';' before '<'

The workaround is

using B::foo;
foo<int> bar;

I think we need a new config macro to describe this bug. BOOST_NO_USING_TEMPLATE_ACROSS_NAMESPACE perhaps?

The bug manifests itself when using iostreams in STLport wrapper mode and affects all iostream classes. Therefore I suggest to add the following to the STLport config file.

#if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_OWN_NAMESPACE) && defined(BOOST_NO_USING_TEMPLATE_ACROSS_NAMESPACE)
# define BOOST_IO_STD(x) x
# define BOOST_IO_NEEDS_USING_DECLARATION
#else
# define BOOST_IO_STD(x) std::##x
#endif

This allows you to write a workaround like this.

#ifdef BOOST_IO_NEEDS_USING_DECLARATION
namespace boost {
  using std::char_traits;
}
#endif

and in the code

namespace boost {
template<class charT, class Traits = BOOST_IO_STD(char_traits)<charT> > class basic_format;
}

instead of

namespace boost {
template<class charT, class Traits = std::char_traits<charT> > class basic_format;
}

Thoughts or comments, anyone?

Markus


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