1/* { dg-do compile } */
2// { dg-additional-options "-std=c++11 -fsanitize=undefined -O2" }
3class ECoordinate { };
4class EPoint {
5public:
6  inline ECoordinate & y ();
7};
8ECoordinate & EPoint::y () { }
9template < class KEY, class CONTENT > class AVLTree;
10template < class KEY, class CONTENT > class AVLTreeNode {
11  friend class
12    AVLTree < KEY, CONTENT >;
13  KEY key;
14  void set_rthread (unsigned char b);
15  void set_lthread (unsigned char b);
16};
17template < class KEY, class CONTENT > class AVLTree {
18public:
19  AVLTree ();
20  void insert (const KEY & key, const CONTENT & c);
21AVLTreeNode < KEY, CONTENT > *root;
22  const KEY * _target_key;
23  virtual int compare (const KEY & k1, const KEY & k2) const;
24  void _add (AVLTreeNode < KEY, CONTENT > *&t);
25  virtual void _status (unsigned int) { }
26};
27template < class KEY, class CONTENT > void AVLTree < KEY, CONTENT >::_add (AVLTreeNode < KEY, CONTENT > *&t) {
28  int cmp = compare (*_target_key, t->key);
29  if (cmp == 0)
30    { _status (1); }
31}
32template < class KEY, class CONTENT > void AVLTree < KEY, CONTENT >::insert (const KEY & key, const CONTENT & c) {
33  if (root == 0) {
34      root->set_rthread (1);
35      root->set_lthread (1);
36    }
37else { _target_key = &key; _add (root); }
38}
39template < class KEY, class CONTENT > AVLTree < KEY, CONTENT >::AVLTree ()
40: root (0) { }
41class ContactRepository {
42  void insertContact (EPoint & pt, int val);
43};
44void ContactRepository::insertContact (EPoint & pt, int val) {
45  AVLTreeNode < ECoordinate, AVLTree < ECoordinate, int >*>*cont_x_node;
46  if (cont_x_node == __null)
47    {
48      AVLTree < ECoordinate, int >*insert_tree = new AVLTree < ECoordinate, int >;
49      insert_tree->insert (pt.y (), val);
50    }
51}
52