[gnu.gcc.bug] Small bug in gcc

derek@UUNET.UU.NET (Derek Clegg) (02/09/89)

/* Version:
 *     gcc version 1.33
 * File:
 *     <this file>
 * Compile with:
 *     gcc -c <this file>
 * Problem:
 *	Incorrect error message.
 * Output:
 *	<this file>: In function bar:
 *	<this file>:28: case label does not reduce to an integer constant
 * Comments:
 *	It seems that `gcc' does not consider a case label containing an
 *	explicit int cast to be an integer constant.
 * Notes:
 *     gcc was compiled with `config.gcc sun3'
 *     I am using a Sun 3/60 with UNIX 4.2 (Sun release 3.5).
 */

enum FOO { A = 1, B = 2 };

int
bar(int type)
{
    switch (type) {
    case (A):
	return (0);
    case ((int)B):
	return (1);
    }
    return (-1);
}

#if 0
	Derek B Clegg ({uunet,ucbcad,sun}!island!fiji!derek)
#endif