Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!gumby!lai From: lai@mips.COM (David Lai) Newsgroups: comp.sys.mips Subject: Re: mips cc bug Message-ID: <39142@mips.mips.COM> Date: 30 May 90 07:44:14 GMT References: <1990May28.152151.5506@maytag.waterloo.edu> Sender: news@mips.COM Reply-To: lai@mips.COM (David Lai) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 52 In article <1990May28.152151.5506@maytag.waterloo.edu> gamiddon@maytag.waterloo.edu (Guy Middleton) writes: >This code works everywhere except on my MIPS machine: > >typedef enum Foo { > None=0, > Some, > All >} Foo; > >main() { > Foo x, y; > > x = (None<<2)|Some; > > switch (x) { > case (((unsigned)None)<<2)|(((unsigned)Some)): > printf( "blah\n" ); > break; > } >} > >MIPS cc says: >ccom: Error: enum.c, line 13: non-constant case expression > case (((unsigned)None)<<2)|(((unsigned)Some)): > -----------------------------------------------^ Bug has been fixed for the 2.10 release: lai> cat x.c typedef enum Foo { None=0, Some, All } Foo; main() { Foo x, y; x = (None<<2)|Some; switch (x) { case (((unsigned)None)<<2)|(((unsigned)Some)): printf( "blah\n" ); break; } } lai> cc -o x x.c lai> x blah -- "What is a DJ if he can't scratch?" - Uncle Jamms Army David Lai (lai@mips.com || {ames,prls,pyramid,decwrl}!mips!lai)