From 718699e90006763f7a55e5e6449e5b9707c5125f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sat, 3 Dec 2005 01:25:42 +0000 Subject: c-typeck.c (default_function_array_conversion, [...]): Allow for CONVERT_EXPR as well as NOP_EXPR. * c-typeck.c (default_function_array_conversion, build_function_call): Allow for CONVERT_EXPR as well as NOP_EXPR. (build_conditional_expr): Apply integer_zerop to orig_op1 and orig_op2. Don't check them for NOP_EXPR. (build_c_cast, convert_for_assignment): Don't check for NOP_EXPR around integer zero. testsuite: * gcc.dg/c90-const-expr-4.c, gcc.dg/c99-const-expr-4.c: New tests. From-SVN: r107990 --- gcc/testsuite/gcc.dg/c99-const-expr-4.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/c99-const-expr-4.c (limited to 'gcc/testsuite/gcc.dg/c99-const-expr-4.c') diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-4.c b/gcc/testsuite/gcc.dg/c99-const-expr-4.c new file mode 100644 index 0000000..f6beaf7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-const-expr-4.c @@ -0,0 +1,11 @@ +/* Test for constant expressions: const variable with value 0 is not a + null pointer constant so the conditional expression should have + type void * and the assignment is OK. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -O2" } */ +int *p; +long *q; +static void *const n = 0; +int j; +void f(void) { q = j ? p : n; } -- cgit v1.1