Commit 2d65b828 by Paolo Carlini Committed by Paolo Carlini

re PR c++/33463 (Broken diagnostic: 'typeid_expr' not supported by dump_expr)

/cp
2007-09-18  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33463
	* cxx-pretty-print.c (pp_cxx_postfix_expression): Split
	out case TYPEID_EXPR to...
	(pp_cxx_typeid_expression): ... here; use pp_cxx_left_paren
	and pp_cxx_right_paren.
	* cxx-pretty-print.h (pp_cxx_typeid_expression): Declare.
	* error.c (dump_expr): Use it.

/testsuite
2007-09-18  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33463
	* g++.dg/rtti/typeid6.C: New.

From-SVN: r128582
parent bdfb7c6d
2007-09-18 Paolo Carlini <pcarlini@suse.de>
PR c++/33463
* cxx-pretty-print.c (pp_cxx_postfix_expression): Split
out case TYPEID_EXPR to...
(pp_cxx_typeid_expression): ... here; use pp_cxx_left_paren
and pp_cxx_right_paren.
* cxx-pretty-print.h (pp_cxx_typeid_expression): Declare.
* error.c (dump_expr): Use it.
2007-09-18 Paolo Carlini <pcarlini@suse.de>
PR c++/33464
* cxx-pretty-print.c (pp_cxx_trait_expression): Add.
(pp_cxx_primary_expression): Use it.
......
......@@ -571,14 +571,7 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
break;
case TYPEID_EXPR:
t = TREE_OPERAND (t, 0);
pp_cxx_identifier (pp, "typeid");
pp_left_paren (pp);
if (TYPE_P (t))
pp_cxx_type_id (pp, t);
else
pp_cxx_expression (pp, t);
pp_right_paren (pp);
pp_cxx_typeid_expression (pp, t);
break;
case PSEUDO_DTOR_EXPR:
......@@ -2147,6 +2140,19 @@ pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
}
void
pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
{
t = TREE_OPERAND (t, 0);
pp_cxx_identifier (pp, "typeid");
pp_cxx_left_paren (pp);
if (TYPE_P (t))
pp_cxx_type_id (pp, t);
else
pp_cxx_expression (pp, t);
pp_cxx_right_paren (pp);
}
void
pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t)
{
cp_trait_kind kind = TRAIT_EXPR_KIND (t);
......
......@@ -70,5 +70,6 @@ void pp_cxx_separate_with (cxx_pretty_printer *, int);
void pp_cxx_declaration (cxx_pretty_printer *, tree);
void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree);
void pp_cxx_trait_expression (cxx_pretty_printer *, tree);
void pp_cxx_typeid_expression (cxx_pretty_printer *, tree);
#endif /* GCC_CXX_PRETTY_PRINT_H */
......@@ -2058,6 +2058,10 @@ dump_expr (tree t, int flags)
pp_cxx_trait_expression (cxx_pp, t);
break;
case TYPEID_EXPR:
pp_cxx_typeid_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. */
......
2007-09-18 Paolo Carlini <pcarlini@suse.de>
PR c++/33463
* g++.dg/rtti/typeid6.C: New.
2007-09-18 Paolo Carlini <pcarlini@suse.de>
PR c++/33464
* g++.dg/ext/is_class_error.C: Rename to is_class_error1.C.
* g++.dg/ext/is_class_error2.C: New.
// PR c++/33463
namespace std
{
class type_info {};
}
template<int> void foo()
{
!typeid(void); // { dg-error "!typeid\\(void\\)|candidates" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment