Bug 43914 - Enum inside switch disfunctional
Summary: Enum inside switch disfunctional
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.4.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-27 20:52 UTC by davidv1992
Modified: 2010-04-27 20:54 UTC (History)
1 user (show)

See Also:
Host: Unknown (x86-64 ubuntu 9.04)
Target: Unknown (x86-64 ubuntu 9.04)
Build: Unknown (x86-64 ubuntu 9.04)
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description davidv1992 2010-04-27 20:52:14 UTC
Following code causes output "Strange" instead of the expected "A":

#include <stdio.h>

typedef enum {a, b, c} k;

k s;

int main()
{
	s = a;
	switch(s)
	{
	a:
		printf("A\n");
	b:
		printf("B\n");
	c:
		printf("C\n");
	default:
		printf("Strange\n");
	}
}
Comment 1 Andrew Pinski 2010-04-27 20:54:31 UTC
        a:

That defines a label called a rather than a case statement.  You want "case a:"