2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.brendan / crash5.C
blob6b9696ea659a772e92b4684b8b374961128de150
1 // { dg-do assemble  }
2 // GROUPS passed old-abort
3 // Should have been fixed by:
4 //
5 // Sun Jun 13 12:55:22 1993  Brendan Kehoe  (brendan@lisa.cygnus.com)
6 // 
7 //      * cp-cvt.c (build_default_binary_type_conversion): Look deeper into
8 //      what ARG1 and ARG2 are if they're POINTER_TYPEs.
10 class CountableSet
12         public:
13                 virtual ~CountableSet() { }             
14 };      
16 template<class T>
17 class FixedSet : virtual public CountableSet
19         public:
20                 virtual int Get(int, T&) = 0;            
21                 virtual ~FixedSet() { }         
24 class ShrinkableSet
26         public:
27                 virtual int Remove(int) = 0;   
30 template<class T>
31 class PVSet : virtual public FixedSet<T>, virtual public ShrinkableSet
33         public:
34                 virtual void Append(const T&) = 0;
35                 virtual void operator+=(const T& a) { Append(a); }
36                 virtual ~PVSet() { }            
39 template<class T>
40 class MutSet : virtual public FixedSet<T>, virtual public FixedSet<T *>
42         protected:
43                 typedef T       *Tp;
45         public:
46                 void Append(const Tp& tp) { Append(*tp); }
48                 T&      Access(int p)
49                 {
50                         Tp      tp;
51                         Get(p, tp);
52                         return *tp;
53                 }
54                 virtual ~MutSet() { }           
57 template <class T>
58 class   SimpleSet : virtual public MutSet<T>
60         protected:
61                 T       *array;
62                 int     size;
64                 virtual void    Allocate(int s)
65                 {
66                         array = new T[s];
67                 }
68         public:
69                 SimpleSet()
70                 {
71                         size = 0;
72                         array = 0;
73                 }
74                 int     Get(int p, T& t)
75                 {
76                         t = array[p-1];
77                         return 1;
78                 }
79                 int     Get(int p, T *& t)
80                 {
81                         t = &array[p-1];
82                         return 1;
83                 }
84                 inline void Append(const T& a)
85                 {
86                         array[size-1] = a;
87                 }
88                 inline int Remove(int n) { return 0; }
91 class   Dummy
93         public:
94                 Dummy() {}
97 int
98 main()
100         SimpleSet<Dummy *>              bs1;
101         int     i, j;
102         Dummy   foo;
104         bs1+=&foo;// { dg-error "" }  no .*