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