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