1/* PR c++/39242, xplicit instantiation declaration prohibits implicit
2   instantiation of non-inline functions.  */
3/* { dg-do compile } */
4/* { dg-options "-O" } */
5
6class Rep {
7public:
8    void unref() const { }
9    static void unref (const Rep * obj_r) { obj_r->unref(); }
10};
11template<typename _Tp, typename _Bt = _Tp>
12class RepPtrStore {
13    _Tp * _obj;
14    void _assign( _Tp * new_r );
15public:
16    ~RepPtrStore() { _assign( 0 ); }
17};
18template<typename _Tp,typename _Bt>
19void RepPtrStore<_Tp,_Bt>::_assign( _Tp * new_r )
20{
21  Rep::unref( _obj );
22}
23class RepPtrBase { };
24template<typename _Bt> class PtrBase : public RepPtrBase { };
25template<typename _Tp, typename _Bt = _Tp>
26class Ptr : public PtrBase<_Bt> {
27    RepPtrStore<_Tp,_Bt> _ptr;
28};
29class YCode;
30class YStatement;
31typedef Ptr<YStatement,YCode> YStatementPtr;
32extern template class RepPtrStore<YStatement,YCode>;
33class ExecutionEnvironment {
34    YStatementPtr m_statement;
35    ~ExecutionEnvironment() { };
36};
37
38