diff options
author | Paolo Carlini <pcarlini@suse.de> | 2007-09-18 15:38:02 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2007-09-18 15:38:02 +0000 |
commit | 2d65b828b292adf5e39bb71addbd671217211cd5 (patch) | |
tree | 0112eedeafb6663855a7150d4e7ef0f39d72379e | |
parent | bdfb7c6d56a79c4bb0c937ee1d4a7186a6aa3438 (diff) | |
download | gcc-2d65b828b292adf5e39bb71addbd671217211cd5.zip gcc-2d65b828b292adf5e39bb71addbd671217211cd5.tar.gz gcc-2d65b828b292adf5e39bb71addbd671217211cd5.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.c | 22 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.h | 1 | ||||
-rw-r--r-- | gcc/cp/error.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/rtti/typeid6.C | 11 |
6 files changed, 45 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c0610b0..504a0c3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,15 @@ 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. diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 156f579..a73a052 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -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); diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h index 2ae834f..f399fea 100644 --- a/gcc/cp/cxx-pretty-print.h +++ b/gcc/cp/cxx-pretty-print.h @@ -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 */ diff --git a/gcc/cp/error.c b/gcc/cp/error.c index b68df74..1854fd6 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 882780f..fe88025 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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. diff --git a/gcc/testsuite/g++.dg/rtti/typeid6.C b/gcc/testsuite/g++.dg/rtti/typeid6.C new file mode 100644 index 0000000..18709b4 --- /dev/null +++ b/gcc/testsuite/g++.dg/rtti/typeid6.C @@ -0,0 +1,11 @@ +// PR c++/33463 + +namespace std +{ + class type_info {}; +} + +template<int> void foo() +{ + !typeid(void); // { dg-error "!typeid\\(void\\)|candidates" } +} |