egcs-970929: nested classes slightly broken

Eric Hennemann cardan@midgard.han.de
Sun Oct 5 05:16:00 GMT 1997


Dear egcs developers,

egcs-970929 breaks on some code containing nested classes inside template
classes (egcs-970917 worked fine).  I was able to cut down the offending
source to the following lines:

--- chainsaw ---

template <int object_size>
struct _object_allocator
{
};

template <class T>
class object_allocator
{
  public:

    // typedefs

    typedef	T *		pointer;

  private:

    static const int obj_size = int (((pointer) 0) + 1);

    typedef	_object_allocator<obj_size>		_allocator;
};

template < class T >
class slist_base
{
    // typedefs, structs & classes

  private:

    struct capsule { };
    struct slist_node;

    typedef	object_allocator<slist_node>	node_allocator;

    typedef	node_allocator::pointer		node_pointer;
};

template < class T >
struct slist_base<T>::slist_node : slist_base<T>::capsule
{
};

template class slist_base<int>;

--- chainsaw ---

egcs-970929 spits out the error message

loki:~$ /opt/bin/eg++ -c asdf.cc -o asdf.o
asdf.cc:18: no type named `capsule' in `class slist_base<int>'
asdf.cc:18: base type `{error}' of `slist_base<int>::slist_node' fails to be a struct or class type
asdf.cc:18: confused by earlier errors, bailing out

System setup:

	i486-pc-linux-gnulibc1
	Linux-2.1.55
	libc-5.4.17

configure was given the options '--prefix=/opt/EGCS --enable-shared'.

I hope this report is of some help ...

	Eric
-- 
	Eric Hennemann		rational, adj.: Devoid of all delusions
	cardan@midgard.han.de	save those of observation, experience
				and reflection.
				 -- A. Bierce, "The Devil's Dictionary"



More information about the Gcc-bugs mailing list