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