diff options
| author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-20 19:06:19 +0000 |
|---|---|---|
| committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-20 19:06:19 +0000 |
| commit | bfc1f4182910d0c8cb0613a214d513b06b334ff1 (patch) | |
| tree | 97024f1a070b7d7df63683cd4f106a692baa01d4 /gcc/c-typeck.c | |
| parent | 087d45e800d8135153d501332beabac757446a9d (diff) | |
| download | ppe42-gcc-bfc1f4182910d0c8cb0613a214d513b06b334ff1.tar.gz ppe42-gcc-bfc1f4182910d0c8cb0613a214d513b06b334ff1.zip | |
* c-typeck.c (build_conditional_expr): When merging type
qualifiers for conditional expressions between a pointer and a
pointer to a void type, merge the qualifiers on the target types
rather than the pointer type. Remove obsolete conditioned out
code.
testsuite:
* gcc.dg/c99-condexpr-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37589 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
| -rw-r--r-- | gcc/c-typeck.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index ada69a8e395..9122a756c83 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3547,13 +3547,15 @@ build_conditional_expr (ifexp, op1, op2) { if (pedantic && TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE) pedwarn ("ISO C forbids conditional expr between `void *' and function pointer"); - result_type = qualify_type (type1, type2); + result_type = build_pointer_type (qualify_type (TREE_TYPE (type1), + TREE_TYPE (type2))); } else if (VOID_TYPE_P (TREE_TYPE (type2))) { if (pedantic && TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE) pedwarn ("ISO C forbids conditional expr between `void *' and function pointer"); - result_type = qualify_type (type2, type1); + result_type = build_pointer_type (qualify_type (TREE_TYPE (type2), + TREE_TYPE (type1))); } else { @@ -3568,10 +3570,6 @@ build_conditional_expr (ifexp, op1, op2) else { op2 = null_pointer_node; -#if 0 /* The spec seems to say this is permitted. */ - if (pedantic && TREE_CODE (type1) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids conditional expr between 0 and function pointer"); -#endif } result_type = type1; } @@ -3582,10 +3580,6 @@ build_conditional_expr (ifexp, op1, op2) else { op1 = null_pointer_node; -#if 0 /* The spec seems to say this is permitted. */ - if (pedantic && TREE_CODE (type2) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids conditional expr between 0 and function pointer"); -#endif } result_type = type2; } |

