boost_no_part_spec_def_args.ipp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // (C) Copyright John Maddock 2008.
  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_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
  7. // TITLE: Default arguments in partial specialization
  8. // DESCRIPTION: The compiler chokes if a partial specialization relies on default arguments in the primary template.
  9. namespace boost_no_partial_specialization_implicit_default_args{
  10. template <class T>
  11. struct one
  12. {
  13. };
  14. template <class T1, class T2 = void>
  15. struct tag
  16. {
  17. };
  18. template <class T1>
  19. struct tag<one<T1> >
  20. {
  21. };
  22. template <class T>
  23. void consume_variable(T const&){}
  24. int test()
  25. {
  26. tag<int> t1;
  27. consume_variable(t1);
  28. tag<one<int> > t2;
  29. consume_variable(t2);
  30. tag<int, double> t3;
  31. consume_variable(t3);
  32. tag<one<int>, double> t4;
  33. consume_variable(t4);
  34. return 0;
  35. }
  36. }