| 1 |
// { dg-do compile } |
| 2 |
template<class T> class intrusive_ptr { |
| 3 |
public: |
| 4 |
~intrusive_ptr() { intrusive_ptr_release( px ); } |
| 5 |
T * px; |
| 6 |
}; |
| 7 |
template <typename T> struct intrusive_base { |
| 8 |
friend void intrusive_ptr_release(T* ptr) { delete ptr; } |
| 9 |
}; |
| 10 |
struct section_info; |
| 11 |
struct file_info : intrusive_base<file_info> { |
| 12 |
intrusive_ptr<file_info> parent; |
| 13 |
intrusive_ptr<section_info> switched_section; |
| 14 |
}; |
| 15 |
struct section_info : intrusive_base<section_info> { |
| 16 |
intrusive_ptr<section_info> parent; |
| 17 |
}; |
| 18 |
struct id_state { |
| 19 |
void * start_file(void); |
| 20 |
}; |
| 21 |
void * id_state::start_file(void) { |
| 22 |
intrusive_ptr<file_info> parent; |
| 23 |
return 0; |
| 24 |
} |
| 25 |
struct id_generation_data : intrusive_base<id_generation_data> { |
| 26 |
void child_length() const {} |
| 27 |
}; |
| 28 |
void generate_id(id_generation_data& generation_data) |
| 29 |
{ |
| 30 |
generation_data.child_length(); |
| 31 |
} |