public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/7508: GCC refuses to compile a declartion right after a 'case' in switch
@ 2002-08-06 11:56 Joseph S. Myers
  0 siblings, 0 replies; 3+ messages in thread
From: Joseph S. Myers @ 2002-08-06 11:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/7508; it has been noted by GNATS.

From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: <ddcc@email.com>
Cc: <gcc-gnats@gcc.gnu.org>,  <gcc-bugs@gcc.gnu.org>
Subject: Re: c/7508: GCC refuses to compile a declartion right after a 'case'
 in switch
Date: Tue, 6 Aug 2002 19:53:58 +0100 (BST)

 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
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c/7508: GCC refuses to compile a declartion right after a 'case' in switch
@ 2002-09-15 13:31 jsm28
  0 siblings, 0 replies; 3+ messages in thread
From: jsm28 @ 2002-09-15 13:31 UTC (permalink / raw)
  To: ddcc, gcc-bugs, gcc-prs, jsm28, nobody

Synopsis: GCC refuses to compile a declartion right after a 'case' in switch

State-Changed-From-To: open->closed
State-Changed-By: jsm28
State-Changed-When: Sun Sep 15 13:31:31 2002
State-Changed-Why:
    As explained, we deliberately do not implement this extension.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7508


^ permalink raw reply	[flat|nested] 3+ messages in thread

* c/7508: GCC refuses to compile a declartion right after a 'case' in switch
@ 2002-08-06  9:36 ddcc
  0 siblings, 0 replies; 3+ messages in thread
From: ddcc @ 2002-08-06  9:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7508
>Category:       c
>Synopsis:       GCC refuses to compile a declartion right after a 'case' in switch
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 06 09:36:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     ddcc@email.com
>Release:        GCC 3.1.1
>Organization:
>Environment:
Seen on MinGW, but probably problem on all platforms
>Description:
GCC refuses to compile a declaration that follows immediately after a 'case' in a 'switch', even in C99 mode:

int main()
	{
	int x = 1;
	switch (x) { case 1: int y = 7; }
	return 0;
	}

Says GCC: In function `main': parse error before "int".

However, if I add a dummy statement before the declaration, GCC compiles it fine:

int main()
	{
	int x = 1;
	switch (x) { case 1: 4 + 5; int y = 7; }
	return 0;
	}
>How-To-Repeat:
Compile the first example in the report.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-15 20:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-06 11:56 c/7508: GCC refuses to compile a declartion right after a 'case' in switch Joseph S. Myers
  -- strict thread matches above, loose matches on Subject: below --
2002-09-15 13:31 jsm28
2002-08-06  9:36 ddcc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).