diff options
author | Gabriel Dos Reis <gdr@integrable-solutions.net> | 2004-06-27 21:36:00 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2004-06-27 21:36:00 +0000 |
commit | 934d729b9539853ab33c8bdbff209fe4692d0797 (patch) | |
tree | eec21d91a29b5e2f66fb5ef48711ebf08e3eb031 /gcc | |
parent | fadabebde64bcfc5b976d397d9186230fedb29db (diff) | |
download | gcc-934d729b9539853ab33c8bdbff209fe4692d0797.zip gcc-934d729b9539853ab33c8bdbff209fe4692d0797.tar.gz gcc-934d729b9539853ab33c8bdbff209fe4692d0797.tar.bz2 |
re PR c++/14123 (odd number of parentheses in error message)
PR c++/14123
* cxx-pretty-print.c (pp_cxx_ptr_operator): Properly put
paranthesis in case of pointers to array members.
* error.c (dump_type_prefix): Likewise.
(dump_type_suffix): Maybe issue a whitespace when printing
ARRAY_TYPE.
From-SVN: r83748
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.c | 2 | ||||
-rw-r--r-- | gcc/cp/error.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/ptrmem5.C | 12 |
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9dabcca..aaf1956 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2004-06-27 Gabriel Dos Reis <gdr@integrable-solutions.net> + + PR c++/14123 + * cxx-pretty-print.c (pp_cxx_ptr_operator): Properly put + paranthesis in case of pointers to array members. + * error.c (dump_type_prefix): Likewise. + (dump_type_suffix): Maybe issue a whitespace when printing + ARRAY_TYPE. + 2004-06-27 Mark Mitchell <mark@codesourcery.com> PR c++/16193 diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index c1337a9..ff377d3 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -1100,6 +1100,8 @@ pp_cxx_ptr_operator (cxx_pretty_printer *pp, tree t) case OFFSET_TYPE: if (TYPE_PTR_TO_MEMBER_P (t)) { + if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) + pp_cxx_left_paren (pp); pp_cxx_nested_name_specifier (pp, TYPE_PTRMEM_CLASS_TYPE (t)); pp_star (pp); pp_cxx_cv_qualifier_seq (pp, t); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 81bba56..2c34e66 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -512,11 +512,14 @@ dump_type_prefix (tree t, int flags) if (TREE_CODE (t) == OFFSET_TYPE) /* pmfs deal with this in d_t_p */ { pp_maybe_space (cxx_pp); + if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) + pp_cxx_left_paren (cxx_pp); dump_type (TYPE_OFFSET_BASETYPE (t), flags); pp_cxx_colon_colon (cxx_pp); } pp_cxx_star (cxx_pp); pp_cxx_cv_qualifier_seq (cxx_pp, t); + pp_base (cxx_pp)->padding = pp_before; break; /* Can only be reached through function pointer -- this would not be @@ -613,6 +616,7 @@ dump_type_suffix (tree t, int flags) } case ARRAY_TYPE: + pp_maybe_space (cxx_pp); pp_cxx_left_bracket (cxx_pp); if (TYPE_DOMAIN (t)) { diff --git a/gcc/testsuite/g++.dg/other/ptrmem5.C b/gcc/testsuite/g++.dg/other/ptrmem5.C new file mode 100644 index 0000000..75a78b2 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/ptrmem5.C @@ -0,0 +1,12 @@ +// PR 14123 + +struct a +{ + int x[8]; +}; + +int main() +{ + int a::*n[8]; + n = &a::x; // { dg-error "int \\(a::\\*\\)" } +} |