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




On Sat, 11 Mar 2000, Martin v. Loewis wrote:

> > 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.

It's a byproduct of me coding at 4am, after a long 16 hour day of school
and work :(.

I'm awfully sorry to have wasted your time over such a mindless error.

(It's just too bad that three days ago I recoded the entire thing to not
use enums, but #defines and const ints.  Ugh.)

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

Remarkable, isn't it?

> 
> Martin
> 

Thanks for your time.  Next time I'll be sure to wait until the next
morning and re-read my code before firing off a bug report :)



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