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]
Other format: [Raw text]

Re: c/7508: GCC refuses to compile a declartion right after a 'case'in switch


On 6 Aug 2002 ddcc@email.com wrote:

> GCC refuses to compile a declaration that follows immediately after a
> 'case' in a 'switch', even in C99 mode:

Although C99 allows declarations and statements to be mixed, it does not
make declarations into statements.  Labels can only be applied to
statements, not to declarations.  As to allowing this as an extension, see
the comment in c-parse.in explaining why we don't:

   NOTE: we don't allow labels on declarations; this might seem like a
   natural extension, but there would be a conflict between attributes
   on the label and prefix attributes on the declaration.  */

-- 
Joseph S. Myers
jsm28@cam.ac.uk


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