Backport:
2007-09-18 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/33462
+ * cxx-pretty-print.c (pp_cxx_va_arg_expression): Add.
+ (pp_cxx_primary_expression): Use it.
+ * cxx-pretty-print.h (pp_cxx_va_arg_expression): Declare.
+ * error.c (dump_expr): Use it.
+
+ 2007-09-18 Paolo Carlini <pcarlini@suse.de>
PR c++/33463
* cxx-pretty-print.c (pp_cxx_postfix_expression): Split
:: operator-function-id
:: qualifier-id
( expression )
- id-expression */
+ id-expression
+
+ GNU Extensions:
+ __builtin_va_arg ( assignment-expression , type-id ) */
static void
pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
pp_cxx_right_paren (pp);
break;
+ case VA_ARG_EXPR:
+ pp_cxx_va_arg_expression (pp, t);
+ break;
+
default:
pp_c_primary_expression (pp_c_base (pp), t);
break;
pp_cxx_right_paren (pp);
}
+void
+pp_cxx_va_arg_expression (cxx_pretty_printer *pp, tree t)
+{
+ pp_cxx_identifier (pp, "va_arg");
+ pp_cxx_left_paren (pp);
+ pp_cxx_assignment_expression (pp, TREE_OPERAND (t, 0));
+ pp_cxx_separate_with (pp, ',');
+ pp_cxx_type_id (pp, TREE_TYPE (t));
+ pp_cxx_right_paren (pp);
+}
+
\f
typedef c_pretty_print_fn pp_fun;
void pp_cxx_declaration (cxx_pretty_printer *, tree);
void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree);
void pp_cxx_typeid_expression (cxx_pretty_printer *, tree);
+void pp_cxx_va_arg_expression (cxx_pretty_printer *, tree);
#endif /* GCC_CXX_PRETTY_PRINT_H */
pp_cxx_typeid_expression (cxx_pp, t);
break;
+ case VA_ARG_EXPR:
+ pp_cxx_va_arg_expression (cxx_pp, t);
+ break;
+
/* This list is incomplete, but should suffice for now.
It is very important that `sorry' does not call
`report_error_function'. That could cause an infinite loop. */
Backport:
2007-09-18 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/33462
+ * g++.dg/ext/va-arg1.C: New.
+
+ 2007-09-18 Paolo Carlini <pcarlini@suse.de>
PR c++/33463
* g++.dg/rtti/typeid6.C: New.
--- /dev/null
+// PR c++/33462
+
+struct A {};
+
+void foo()
+{
+ ++__builtin_va_arg(0, A); // { dg-error "'\\+\\+va_arg\\(0, A\\)'" }
+}