| 1 | #include <iostream> |
| 2 | |
| 3 | template<typename DATA> |
| 4 | struct ATB |
| 5 | { |
| 6 | int data; |
| 7 | ATB() : data(0) {} |
| 8 | }; |
| 9 | |
| 10 | |
| 11 | template<typename DATA, |
| 12 | typename DerivedType > |
| 13 | class A : public ATB<DATA> |
| 14 | { |
| 15 | public: |
| 16 | static DerivedType const DEFAULT_INSTANCE; |
| 17 | }; |
| 18 | |
| 19 | template<typename DATA, typename DerivedType> |
| 20 | const DerivedType A<DATA, DerivedType>::DEFAULT_INSTANCE; |
| 21 | |
| 22 | class B : public A<int, B> |
| 23 | { |
| 24 | |
| 25 | }; |
| 26 | |
| 27 | int main() |
| 28 | { |
| 29 | B b; |
| 30 | // If this if-block is removed then GDB shall |
| 31 | // not infinitely recurse when trying to print b. |
| 32 | |
| 33 | return 0; // marker |
| 34 | } |
| 35 | |
| 36 | |