+2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * c-parse.in (unary_expr): Move VA_ARG from here ...
+ (primary): ... to here.
+
2000-11-23 Graham Stott <grahams@redhat.com>
* expr.c (store_constructor): If a field is non addressable and
{ $$ = build_unary_op (REALPART_EXPR, $2, 0); }
| IMAGPART cast_expr %prec UNARY
{ $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
- | VA_ARG '(' expr_no_commas ',' typename ')'
- { $$ = build_va_arg ($3, groktypename ($5)); }
;
sizeof:
}
| primary '(' exprlist ')' %prec '.'
{ $$ = build_function_call ($1, $3); }
+ | VA_ARG '(' expr_no_commas ',' typename ')'
+ { $$ = build_va_arg ($3, groktypename ($5)); }
| primary '[' expr ']' %prec '.'
{ $$ = build_array_ref ($1, $3); }
| primary '.' identifier
+2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (unary_expr): Move VA_ARG from here ...
+ (primary): ... to here.
+
2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
* semantics.c (finish_id_expr): If type is error_mark, return
{ $$ = build_x_unary_op (REALPART_EXPR, $2); }
| IMAGPART cast_expr %prec UNARY
{ $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
- | VA_ARG '(' expr_no_commas ',' type_id ')'
- { $$ = build_x_va_arg ($3, groktypename ($5.t));
- check_for_new_type ("__builtin_va_arg", $5); }
;
new_placement:
{ $$ = finish_call_expr ($1, $3, 0); }
| primary LEFT_RIGHT
{ $$ = finish_call_expr ($1, NULL_TREE, 0); }
+ | VA_ARG '(' expr_no_commas ',' type_id ')'
+ { $$ = build_x_va_arg ($3, groktypename ($5.t));
+ check_for_new_type ("__builtin_va_arg", $5); }
| primary '[' expr ']'
{ $$ = grok_array_decl ($$, $3); }
| primary PLUSPLUS
+2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old-deja/g++.other/vaarg4.C: New test.
+ * gcc.c-torture/compile/20001123-1.c: New test.
+
2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
* g++.other/crash24.C: Adjust and remove XFAIL.
--- /dev/null
+// Build don't link:
+
+// Bug 845. We were treating __builtin_va_arg as a unary expr, not a primary,
+// and hence getting parse errors.
+
+typedef __builtin_va_list __gnuc_va_list;
+typedef __gnuc_va_list va_list;
+
+struct X { int y; };
+
+void func(va_list va)
+{
+ char* a = __builtin_va_arg(va, char**)[0];
+ int b = __builtin_va_arg(va, X*)->y;
+}
--- /dev/null
+
+typedef __builtin_va_list __gnuc_va_list;
+typedef __gnuc_va_list va_list;
+
+struct X { int y; };
+
+void func(va_list va)
+{
+ char* a = __builtin_va_arg(va, char**)[0];
+ int b = __builtin_va_arg(va, struct X*)->y;
+}