From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10850 invoked by alias); 21 Oct 2002 07:56:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 10794 invoked by uid 71); 21 Oct 2002 07:56:01 -0000 Resent-Date: 21 Oct 2002 07:56:01 -0000 Resent-Message-ID: <20021021075601.10791.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, mcmartin@stanford.edu Received: (qmail 8374 invoked by uid 61); 21 Oct 2002 07:55:14 -0000 Message-Id: <20021021075514.8373.qmail@sources.redhat.com> Date: Mon, 21 Oct 2002 00:56:00 -0000 From: mcmartin@stanford.edu Reply-To: mcmartin@stanford.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: java/8298: Incomplete enforcement of constant expressions in switch/case X-SW-Source: 2002-10/txt/msg00771.txt.bz2 List-Id: >Number: 8298 >Category: java >Synopsis: Incomplete enforcement of constant expressions in switch/case >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: accepts-illegal >Submitter-Id: net >Arrival-Date: Mon Oct 21 00:56:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: mcmartin@stanford.edu >Release: gcj 3.2 >Organization: >Environment: >Description: The GCJ front-end should reject this, as the cases y.a and y.b don't match the definition of ConstantExpression in section 15.28 of the JLS (as required for cases in a switch in section 14.10 of the JLS): public class test { static final int a = 1; static final int b = 2; public static void main(String[] args) { int x = 2; test y = new test(); switch(x) { case y.a: System.out.println("Equal to a"); break; case y.b: System.out.println("Equal to b"); break; default: System.out.println("Something random"); break; } } } >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: