PR c/13519 * c-typeck.c (composite_type, common_pointer_type): New functions. (common_type): Split parts into composite_type and common_pointer_type. Ensure that arithmetic operations return unqualified types without attributes. Don't make composite type of signed enum and compatible integer be unsigned. (build_conditional_expr, build_binary_op): Use common_pointer_type. * c-decl.c (merge_decls): Use composite_type. * c-tree.h (composite_type): Declare. testsuite: * gcc.c-torture/enum-3.c, gcc.dg/pr13519-1.c: New tests. From-SVN: r82671
25 lines
416 B
C
25 lines
416 B
C
/* The composite type of int and an enum compatible with int might be
|
|
either of the two types, but it isn't an unsigned type. */
|
|
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
|
|
|
|
#include <limits.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
extern void abort (void);
|
|
extern void exit (int);
|
|
|
|
enum e { a = INT_MIN };
|
|
|
|
int *p;
|
|
enum e *q;
|
|
int
|
|
main (void)
|
|
{
|
|
enum e x = a;
|
|
q = &x;
|
|
if (*(1 ? q : p) > 0)
|
|
abort ();
|
|
exit (0);
|
|
}
|