error

Mark Wright markw@odi.com.au
Wed Mar 31 23:54:00 GMT 1999


Hello Marek,

I try to compile it with Sun C++ 4.2 on Solaris 2.6 SPARC
and I get:

/export/home/markw> CC x.cpp
"x.cpp", line 88: Error: Type name expected instead of "E".
"x.cpp", line 91: Error: Type name expected instead of "tmp".
"x.cpp", line 93: Error: Unexpected "}".
3 Error(s) detected.
/export/home/markw>

So its missing the:

template <class E>

on line 88 before the:

E *t_list<E>::get_prev(void)

Fixing this it compiles fine.

Regards, Mark

> /* I had try to compile this
>   and next error occure:
> $ gcc -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.29/specs
> gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
> 
> $gcc u.cc
> u.cc:88: Internal compiler error.
> u.cc:88: Please submit a full bug report to `egcs-bugs@cygnus.com'.
> 
> Compilation exited abnormally with code 1 at Tue Mar 30 14:29:12
> 
> */
> 
> #include <stdlib.h>
> #include <string.h>
> 
> 
> class t_vzor
> {
> public:	
>  char		 *name;	
>  int               ok;	
>  t_vzor           *next, *next_joined;
>  //	t_lemma_l        *l;
> 
>  t_vzor(char *n_name, char *suff) {
>   //name        = strdup(n_name);
>   //l           = user_suff2lm(suff);
>   next        = NULL;
>   next_joined = NULL;
>  }
>  ~t_vzor(void) {
>   if (name) free(name);
>  }
> };
> 
> template <class E>
> class t_list_member;
> 
> template <class E>
> class t_list
> {
>  t_list_member<E> *first, *last, *tmp;
> public:
>  E *get_cur (void);
>  E *get_next(void);
>  E *get_prev(void);
> 
>  void add_last (E *v);
>  void add_first(E *v);
> 
>  t_list(void) {
>   first = last = tmp = NULL;
>  }
>  ~t_list(void) {
>  }
> };
> 
> template <class E>
> class t_list_member
> {
> public:
>  t_list<E> *next, *prev;
>  t_list_member (E *v, t_list<E> &l,
>          int f_l=1 /* 0 .. first, 1 .. last */) {
>   ptr = v;
>   if (!f_l)
>   {
>    prev = NULL;
>    next = l->first;
>    if (!l->first) l->last = this;
>    else l->first->prev = this;
>    l->first = this;
>   }
>   else
>   {
>    prev = l->last;
>    next = NULL;
>    if (!l->last) l->first = this;
>    else l->last->next = this;
>    l->last = this;
>   }
>  }
>  ~t_list_member(void) {
>  }
> };
> 
> template <class E>
> E *t_list<E>::get_cur (void)
> {
>  if (!tmp) return (E *)NULL;
>  return tmp->ptr;
> }
> template <class E>
> E *t_list<E>::get_next(void)
> {
>  if (tmp) tmp = tmp->next;
>  else tmp = first;
>  return get_cur();
> }
> E *t_list<E>::get_prev(void)
> {
>  if (tmp) tmp = tmp->prev;
>  else tmp = last;
>  return get_cur();
> }
> 
> /*
> class t_suff_node
> {
>  int c;
>  t_vzor_l *vl;
> };
> */
> 
> t_list<t_vzor> vzory;
> 
> 
> 





More information about the Gcc-bugs mailing list