| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-std=c++11 -O2" } */ |
| 3 |
|
| 4 |
class A |
| 5 |
{ |
| 6 |
public: |
| 7 |
void |
| 8 |
getValueType () |
| 9 |
{ |
| 10 |
} |
| 11 |
void getTypeClass (); |
| 12 |
}; |
| 13 |
template <typename ImplClass> class B |
| 14 |
{ |
| 15 |
public: |
| 16 |
void |
| 17 |
Visit (A *p1) |
| 18 |
{ |
| 19 |
p1->getTypeClass (); |
| 20 |
static_cast<ImplClass *> (0)->VisitAtomicType (0); |
| 21 |
} |
| 22 |
}; |
| 23 |
class C : B<C> |
| 24 |
{ |
| 25 |
template <typename Fn> |
| 26 |
void |
| 27 |
dumpChild (Fn p1) |
| 28 |
{ |
| 29 |
p1 (); |
| 30 |
} |
| 31 |
|
| 32 |
public: |
| 33 |
void dumpTypeAsChild (int); |
| 34 |
void |
| 35 |
VisitAtomicType (A *p1) |
| 36 |
{ |
| 37 |
p1->getValueType (); |
| 38 |
dumpTypeAsChild (0); |
| 39 |
} |
| 40 |
}; |
| 41 |
void |
| 42 |
C::dumpTypeAsChild (int) |
| 43 |
{ |
| 44 |
dumpChild ([=] |
| 45 |
{ |
| 46 |
Visit (0); |
| 47 |
}); |
| 48 |
} |