This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GCC Bug Report


> However, according to the C++ text that I have (written by Stroustrup
> -sp?) indicates that the code that I am attempting to write is indeed
> valid.
> 
> gcc 2.7.2.3 compiles it correctly, without fault in execution.
> Can someone verify whether this is indeed a nasty byproduct of the
> gcc/egcs merger, or just something that slipped through the cracks?

Hmm. In your code, I see

    switch (event->eventType) {
      case arrival: 
      case service:
      case departure:
      default:
        break;
  }

In this context, event is 

    _event *event = new _event;

where _event is defined as

struct _event {
  int classEvent;			 
  eventType typeEvent;			 
  int timeInter;			 
  int timeArrival;		 	 
  int timeService;			 
  int timeWait;				 
  int timeDepart;			 
};

There is no field "eventType" in this struct. OTOH, there is a

enum eventType { arrival, service, departure };

Hence the error

a3.c:48: invalid use of type decl `enum eventType' as expression

If that is corrected, the other error still remains. This is caused by
a missing curly bracket from the switch statement; what I quoted above
was indeed the curly bracket from the while statement.

If that is also corrected, g++ 2.95 compiles your code just fine. So I
guess I cannot confirm that this is nasty byproduct of the gcc/egcs
merger, or just something that slipped through the cracks.

Isn't it interesting that gcc 2.7 compiled this code?

Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]