• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6//  See http://www.boost.org/libs/config for most recent version.
7
8//  MACRO:         BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
9//  TITLE:         dependent nested template classes
10//  DESCRIPTION:   The compiler fails to compile
11//                 a nested class that has a dependent base class:
12//                 template<typename T>
13//                 struct foo : {
14//                    template<typename U>
15//                    struct bar : public U {};
16//                 };
17#ifndef BOOST_NESTED_TEMPLATE
18#define BOOST_NESTED_TEMPLATE template
19#endif
20
21
22namespace boost_no_dependent_nested_derivations{
23
24struct UDT1{};
25struct UDT2{};
26
27template<typename T>
28struct foo
29{
30  template<typename U>
31  struct bar : public foo<U>
32  {};
33};
34
35template <class T>
36void foo_test(T)
37{
38   typedef foo<T> foo_type;
39   typedef typename foo_type::BOOST_NESTED_TEMPLATE bar<UDT2> bar_type;
40   foo<T> ft;
41   bar_type bt;
42   (void) &bt;
43   (void) &ft;
44}
45
46int test()
47{
48   foo_test(UDT1());
49   return 0;
50}
51
52}
53
54
55
56
57
58
59