From d897f7c2662b96117752b1f5c56b547eaa994f5c Mon Sep 17 00:00:00 2001 From: bonzini Date: Thu, 17 Aug 2006 07:02:55 +0000 Subject: 2006-08-17 Paolo Bonzini PR c++/28573 * c-common.c (fold_offsetof_1): Add an argument and recurse down to it or the INTEGER_CST. Fail on a CALL_EXPR. (fold_offsetof): Pass new argument to fold_offsetof_1. * c-parser.c (c_parser_postfix_expression): Don't include a NULL operand into an INDIRECT_REF. * c-typeck.c (build_unary_op): Adjust call to fold_offsetof. cp: 2006-08-17 Paolo Bonzini PR c++/28573 * semantics.c (finish_offsetof): Add new argument to fold_offsetof. testsuite: 2006-08-17 Paolo Bonzini PR c++/28573 * g++.dg/parse/offsetof6.C: New test. * g++.dg/parse/offsetof7.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116208 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/c-parser.c') diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 6e243dff58a..9031e5b4d2f 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -5203,7 +5203,7 @@ c_parser_postfix_expression (c_parser *parser) if (type == error_mark_node) offsetof_ref = error_mark_node; else - offsetof_ref = build1 (INDIRECT_REF, type, NULL); + offsetof_ref = build1 (INDIRECT_REF, type, null_pointer_node); /* Parse the second argument to __builtin_offsetof. We must have one identifier, and beyond that we want to accept sub structure and sub array references. */ @@ -5245,7 +5245,7 @@ c_parser_postfix_expression (c_parser *parser) c_parser_error (parser, "expected identifier"); c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>"); - expr.value = fold_offsetof (offsetof_ref); + expr.value = fold_offsetof (offsetof_ref, NULL_TREE); expr.original_code = ERROR_MARK; } break; -- cgit v1.2.1