Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2002-07-17 00:42:47


I have found that using declarations cannot be used in class templates
on certain compilers as in the following example:

// [code]
 struct test_base {
        static void f() { }
 };

 template <typename T, typename base>
 struct test_using : base {
         using base::f;
         static T f(const T& t) { return t; }
 };

 int main() {
  test_using<int, test_using<double, test_base> > test;
  test.f();
  test.f(2);
  test.f(3.14);
 }
// [/code]

So far, I have discovered that Visual C++ 7 (and undoubtedly 6.5 as
well) and GCC 2.9.5 are not able to compile this (correct) code.

I therefore propose that a new config macro be added to the appropriate
compiler config headers. As a suggestion,
BOOST_NO_CLASS_TEMPLATE_USING_DECLARATIONS seems an appropriate and
descriptive name.

Comments? Who is the person who would be able to make the changes to the
config headers (if the time comes)? And what other compilers suffer from
the same bug?

Thanks,
Eric Friedman


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