// { dg-do assemble }
|
// { dg-do assemble }
|
// GROUPS passed old-abort
|
// GROUPS passed old-abort
|
// Should have been fixed by:
|
// Should have been fixed by:
|
//
|
//
|
// Sun Jun 13 12:55:22 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
|
// Sun Jun 13 12:55:22 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
|
//
|
//
|
// * cp-cvt.c (build_default_binary_type_conversion): Look deeper into
|
// * cp-cvt.c (build_default_binary_type_conversion): Look deeper into
|
// what ARG1 and ARG2 are if they're POINTER_TYPEs.
|
// what ARG1 and ARG2 are if they're POINTER_TYPEs.
|
|
|
class CountableSet
|
class CountableSet
|
{
|
{
|
public:
|
public:
|
virtual ~CountableSet() { }
|
virtual ~CountableSet() { }
|
};
|
};
|
|
|
template
|
template
|
class FixedSet : virtual public CountableSet
|
class FixedSet : virtual public CountableSet
|
{
|
{
|
public:
|
public:
|
virtual int Get(int, T&) = 0;
|
virtual int Get(int, T&) = 0;
|
virtual ~FixedSet() { }
|
virtual ~FixedSet() { }
|
};
|
};
|
|
|
class ShrinkableSet
|
class ShrinkableSet
|
{
|
{
|
public:
|
public:
|
virtual int Remove(int) = 0;
|
virtual int Remove(int) = 0;
|
};
|
};
|
|
|
template
|
template
|
class PVSet : virtual public FixedSet, virtual public ShrinkableSet
|
class PVSet : virtual public FixedSet, virtual public ShrinkableSet
|
{
|
{
|
public:
|
public:
|
virtual void Append(const T&) = 0;
|
virtual void Append(const T&) = 0;
|
virtual void operator+=(const T& a) { Append(a); }
|
virtual void operator+=(const T& a) { Append(a); }
|
virtual ~PVSet() { }
|
virtual ~PVSet() { }
|
};
|
};
|
|
|
template
|
template
|
class MutSet : virtual public FixedSet, virtual public FixedSet
|
class MutSet : virtual public FixedSet, virtual public FixedSet
|
{
|
{
|
protected:
|
protected:
|
typedef T *Tp;
|
typedef T *Tp;
|
|
|
public:
|
public:
|
void Append(const Tp& tp) { Append(*tp); }
|
void Append(const Tp& tp) { Append(*tp); }
|
|
|
T& Access(int p)
|
T& Access(int p)
|
{
|
{
|
Tp tp;
|
Tp tp;
|
Get(p, tp);
|
Get(p, tp);
|
return *tp;
|
return *tp;
|
}
|
}
|
virtual ~MutSet() { }
|
virtual ~MutSet() { }
|
};
|
};
|
|
|
template
|
template
|
class SimpleSet : virtual public MutSet
|
class SimpleSet : virtual public MutSet
|
{
|
{
|
protected:
|
protected:
|
T *array;
|
T *array;
|
int size;
|
int size;
|
|
|
virtual void Allocate(int s)
|
virtual void Allocate(int s)
|
{
|
{
|
array = new T[s];
|
array = new T[s];
|
}
|
}
|
public:
|
public:
|
SimpleSet()
|
SimpleSet()
|
{
|
{
|
size = 0;
|
size = 0;
|
array = 0;
|
array = 0;
|
}
|
}
|
int Get(int p, T& t)
|
int Get(int p, T& t)
|
{
|
{
|
t = array[p-1];
|
t = array[p-1];
|
return 1;
|
return 1;
|
}
|
}
|
int Get(int p, T *& t)
|
int Get(int p, T *& t)
|
{
|
{
|
t = &array[p-1];
|
t = &array[p-1];
|
return 1;
|
return 1;
|
}
|
}
|
inline void Append(const T& a)
|
inline void Append(const T& a)
|
{
|
{
|
array[size-1] = a;
|
array[size-1] = a;
|
}
|
}
|
inline int Remove(int n) { return 0; }
|
inline int Remove(int n) { return 0; }
|
};
|
};
|
|
|
class Dummy
|
class Dummy
|
{
|
{
|
public:
|
public:
|
Dummy() {}
|
Dummy() {}
|
};
|
};
|
|
|
int
|
int
|
main()
|
main()
|
{
|
{
|
SimpleSet bs1;
|
SimpleSet bs1;
|
int i, j;
|
int i, j;
|
Dummy foo;
|
Dummy foo;
|
|
|
bs1+=&foo;// { dg-error "" } no .*
|
bs1+=&foo;// { dg-error "" } no .*
|
}
|
}
|
|
|