gcc/testsuite/g++.dg/expr/static_cast3.C
raw| 1 | template <class T> struct static_abort {}; |
| 2 | |
| 3 | template <class E> |
| 4 | struct any |
| 5 | { |
| 6 | const E& self() const { return static_cast<const E&>(*this); } |
| 7 | }; |
| 8 | |
| 9 | struct range : public any<range> |
| 10 | { |
| 11 | range() {} |
| 12 | |
| 13 | template <class U> |
| 14 | range(const U&) |
| 15 | { |
| 16 | typedef typename static_abort<U>::ret t; |
| 17 | } |
| 18 | }; |
| 19 | |
| 20 | int main() |
| 21 | { |
| 22 | const any<range>& r = *new range(); |
| 23 | r.self(); |
| 24 | } |