projects
/
cparser
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e344e92
)
Do default promotion on the expression of switch()es.
author
Christoph Mallon
<christoph.mallon@gmx.de>
Tue, 11 Dec 2007 21:41:18 +0000
(21:41 +0000)
committer
Christoph Mallon
<christoph.mallon@gmx.de>
Tue, 11 Dec 2007 21:41:18 +0000
(21:41 +0000)
[r18683]
parser.c
patch
|
blob
|
history
diff --git
a/parser.c
b/parser.c
index
fb7ce4e
..
303bef6
100644
(file)
--- a/
parser.c
+++ b/
parser.c
@@
-4914,7
+4914,9
@@
static statement_t *parse_switch(void)
statement->statement.source_position = token.source_position;
expect('(');
statement->statement.source_position = token.source_position;
expect('(');
- statement->expression = parse_expression();
+ expression_t *const expr = parse_expression();
+ type_t *const type = promote_integer(expr->base.datatype);
+ statement->expression = create_implicit_cast(expr, type);
expect(')');
statement->body = parse_statement();
expect(')');
statement->body = parse_statement();