1 // RUN: %clang_cc1 -emit-llvm %s -o -
2 // PR1634
3 
4 namespace Manta
5 {
6   class CallbackHandle
7   {
~CallbackHandle(void)8   protected:virtual ~ CallbackHandle (void)
9     {
10     }
11   };
12 template < typename Data1 > class CallbackBase_1Data:public CallbackHandle
13   {
14   };
15 }
16 
17 namespace __gnu_cxx
18 {
19   template < typename _Iterator, typename _Container >
20   class __normal_iterator
21   {
22     _Iterator _M_current;
23   };
24 }
25 
26 namespace std
27 {
28   template < typename _Tp > struct allocator
29   {
30     typedef _Tp *pointer;
31   };
32   template < typename _InputIterator,
find(_InputIterator __last,const _Tp & __val)33     typename _Tp > inline void find (_InputIterator __last,
34 					       const _Tp & __val)
35   {
36   };
37 }
38 
39 namespace Manta
40 {
41   template < typename _Tp, typename _Alloc> struct _Vector_base
42   {
43     struct _Vector_impl
44     {
45       _Tp *_M_start;
46     };
47   public:
48     _Vector_impl _M_impl;
49   };
50   template < typename _Tp, typename _Alloc = std::allocator < _Tp > >
51   class vector:protected _Vector_base < _Tp,_Alloc >
52   {
53   public:
54     typedef __gnu_cxx::__normal_iterator < typename _Alloc::pointer,
55       vector < _Tp, _Alloc > > iterator;
end()56     iterator end ()
57     {
58     }
59   };
60   class MantaInterface
61   {
62   };
63   class RTRT
64   {
65     virtual CallbackHandle *registerTerminationCallback (CallbackBase_1Data <
66 							 MantaInterface * >*);
67     virtual void unregisterCallback (CallbackHandle *);
68     typedef vector < CallbackBase_1Data < int >*>PRCallbackMapType;
69     PRCallbackMapType parallelPreRenderCallbacks;
70   };
71 }
72 using namespace Manta;
73 CallbackHandle *
registerTerminationCallback(CallbackBase_1Data<MantaInterface * > * cb)74 RTRT::registerTerminationCallback (CallbackBase_1Data < MantaInterface * >*cb)
75 {
76   return cb;
77 }
78 
79 void
unregisterCallback(CallbackHandle * callback)80 RTRT::unregisterCallback (CallbackHandle * callback)
81 {
82   {
83     typedef CallbackBase_1Data < int > callback_t;
84     callback_t *cb = static_cast < callback_t * >(callback);
85     find (parallelPreRenderCallbacks.end (), cb);
86   }
87 }
88