boost_no_using_decl_overld.ipp 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. // (C) Copyright Eric Friedman 2002.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // MACRO: BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
  6. // TITLE: using declaration function overloads from a typename base
  7. // DESCRIPTION: The compiler will not accept a using declaration
  8. // that brings a function from a typename used as a base class
  9. // into a derived class if functions of the same name
  10. // are present in the derived class.
  11. namespace boost_no_using_declaration_overloads_from_typename_base {
  12. struct base
  13. {
  14. static void f() { }
  15. };
  16. template <typename T, typename Base>
  17. struct using_overloads_from_typename_base : Base
  18. {
  19. using Base::f;
  20. static T f(const T& t) { return t; }
  21. };
  22. int test()
  23. {
  24. using_overloads_from_typename_base<int,base>::f();
  25. return using_overloads_from_typename_base<int,base>::f(0);
  26. }
  27. }