boost_no_typename_with_ctor.ipp 783 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright (C) 2008 N. Musatti
  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_TYPENAME_WITH_CTOR
  7. // TITLE: Use of typename keyword with constructors
  8. // DESCRIPTION: If the compiler rejects the typename keyword when calling
  9. // the constructor of a dependent type
  10. namespace boost_no_typename_with_ctor {
  11. struct A {};
  12. template <typename T>
  13. struct B {
  14. typedef T type;
  15. };
  16. template <typename T>
  17. typename T::type f() {
  18. return typename T::type();
  19. }
  20. int test() {
  21. A a = f<B<A> >();
  22. (void)a;
  23. return 0;
  24. }
  25. }