boost_no_exp_func_tem_arg.ipp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // (C) Copyright John Maddock 2001.
  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. // See http://www.boost.org/libs/config for most recent version.
  6. // MACRO: BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
  7. // TITLE: non-deduced function template parameters
  8. // DESCRIPTION: Can only use deduced template arguments when
  9. // calling function template instantiations.
  10. #if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200)
  11. #error "This is known to be buggy under VC6"
  12. #endif
  13. namespace boost_no_explicit_function_template_arguments{
  14. struct foo
  15. {
  16. template<class T> int bar(){return 0;}
  17. template<int I> int bar(){return 1;}
  18. };
  19. int test_0()
  20. {
  21. return 0;
  22. }
  23. template <int i>
  24. bool foo_17041(int j)
  25. {
  26. return (i == j);
  27. }
  28. int test()
  29. {
  30. foo f;
  31. int a = f.bar<char>();
  32. int b = f.bar<2>();
  33. if((a !=0) || (b != 1))return -1;
  34. if(0 == foo_17041<8>(8)) return -1;
  35. if(0 == foo_17041<4>(4)) return -1;
  36. if(0 == foo_17041<5>(5)) return -1;
  37. return 0;
  38. }
  39. }