boost_no_extern_template.ipp 893 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // (C) Copyright Beman Dawes 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 more information.
  6. // MACRO: BOOST_NO_CXX11_EXTERN_TEMPLATE
  7. // TITLE: C++0x extern template unavailable
  8. // DESCRIPTION: The compiler does not support C++0x extern template
  9. namespace boost_no_cxx11_extern_template {
  10. template<class T, class U> void f(T const* p, U const* q)
  11. {
  12. p = q;
  13. }
  14. template <class T>
  15. class must_not_compile
  16. {
  17. public:
  18. void f(T const* p, int const* q);
  19. };
  20. template <class T>
  21. void must_not_compile<T>::f(T const* p, int const* q)
  22. {
  23. p = q;
  24. }
  25. extern template void f<>(int const*, float const*);
  26. extern template class must_not_compile<int>;
  27. int test()
  28. {
  29. return 0;
  30. }
  31. }