User account creation filtered due to spam.

Bug 19674 - Empty declaration through semicolon (;) causes compile failure
Summary: Empty declaration through semicolon (;) causes compile failure
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
Keywords: diagnostic, rejects-valid
Depends on:
Blocks: 18131
  Show dependency treegraph
Reported: 2005-01-28 18:08 UTC by Mark Wielaard
Modified: 2005-07-06 19:08 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-04-30 16:11:11


Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2005-01-28 18:08:25 UTC
The following program doesn't compile:

public interface OutSideInterface
  public interface InsideInterface
    void m(int p, int p2);

Note the empty statement (semicolon) on line 6.
This is legal (jikes accepts it) but deprecated.

Compiling with -C gives: error: '{' expected.
      ^ error: Class or interface declaration expected.
2 errors

Reported by Jerry Haltom.

With -Wextraneous-semicolon the compiler does see that this is just an declaration: warning: An empty declaration is a deprecated feature
that should not be used.
Comment 1 2005-01-28 18:19:21 UTC
The relevant JLS production is ClassMemberDeclaration:
Comment 2 Andrew Pinski 2005-01-28 19:04:19 UTC
Comment 3 Bryce McKinlay 2005-06-18 01:50:44 UTC
I'm testing a patch.
Comment 4 CVS Commits 2005-07-05 21:10:13 UTC
Subject: Bug 19674

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	2005-07-05 21:09:58

Modified files:
	gcc/java       : ChangeLog parse.y 
	libjava        : ChangeLog 
Added files:

Log message:
	2005-07-05  Bryce McKinlay  <>
	PR java/19674
	* parse.y (interface_member_declaration): Allow empty statements in
	interface declarations.
	2005-07-05  Bryce McKinlay  <>
	* testsuite/libjava.compile/ New test.


Comment 5 Bryce McKinlay 2005-07-06 19:05:53 UTC
Fixed in HEAD
Comment 6 CVS Commits 2005-07-12 22:35:13 UTC
Subject: Bug 19674

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	2005-07-12 22:35:04

Modified files:
	gcc/java       : ChangeLog jvspec.c parse-scan.y 

Log message:
	PR java/19674:
	* parse-scan.y (interface_member_declaration): Added