summaryrefslogtreecommitdiff
path: root/gcc/c-parser.c
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-15 18:01:19 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-15 18:01:19 +0000
commit0e9b75a86c4ac4218978ef271df570ffed9e4f92 (patch)
treec67b6c012b86ed35cb28402e0f422833b7295e5f /gcc/c-parser.c
parent26f73e103ce90020ca42ccde4e03e7da02aa2b99 (diff)
downloadgcc-0e9b75a86c4ac4218978ef271df570ffed9e4f92.tar.gz
PR c/28280
* c-parser.c (c_parser_typeof_specifier): Don't use c_finish_expr_stmt, open code desired semantics instead. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116163 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r--gcc/c-parser.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 848da6305dc..6e243dff58a 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -2164,7 +2164,19 @@ c_parser_typeof_specifier (c_parser *parser)
is evaluated, this can be evaluated. For now, we avoid
evaluation when the context might. */
if (!skip_evaluation && was_vm)
- c_finish_expr_stmt (expr.value);
+ {
+ tree e = expr.value;
+
+ /* If the expression is not of a type to which we cannot assign a line
+ number, wrap the thing in a no-op NOP_EXPR. */
+ if (DECL_P (e) || CONSTANT_CLASS_P (e))
+ e = build1 (NOP_EXPR, void_type_node, e);
+
+ if (EXPR_P (e))
+ SET_EXPR_LOCATION (e, input_location);
+
+ add_stmt (e);
+ }
pop_maybe_used (was_vm);
}
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");