From 10a6624ad69dfd612245deecbc1fcaee80d42e2c Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 2 Nov 2007 14:06:43 +0000 Subject: [PATCH] re PR c++/33495 (Broken diagnostic: Trouble pretty-printing statement expressions) 2007-11-02 Paolo Carlini PR c++/33495 * error.c (dump_expr): Deal specially with statements. 2007-11-02 Paolo Carlini PR c++/33495 * g++.dg/other/error19.C: New. From-SVN: r129850 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/error.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/other/error19.C | 7 +++++++ 4 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/other/error19.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 90bea18d704..3a90378b97c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2007-11-02 Paolo Carlini + + PR c++/33495 + * error.c (dump_expr): Deal specially with statements. + 2007-11-01 Jason Merrill PR c++/30897 diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 031a22129d7..49ded5e496b 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1437,6 +1437,12 @@ dump_expr (tree t, int flags) if (t == 0) return; + if (STATEMENT_CLASS_P (t)) + { + pp_cxx_identifier (cxx_pp, ""); + return; + } + switch (TREE_CODE (t)) { case VAR_DECL: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4303ca49c00..900d322b384 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-11-02 Paolo Carlini + + PR c++/33495 + * g++.dg/other/error19.C: New. + 2007-11-02 Eric Botcazou PR rtl-optimization/28062 diff --git a/gcc/testsuite/g++.dg/other/error19.C b/gcc/testsuite/g++.dg/other/error19.C new file mode 100644 index 00000000000..9389dc17000 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/error19.C @@ -0,0 +1,7 @@ +// PR c++/33495 + +void foo() +{ + if (({while(true);})) // { dg-error "forbids|" } + ; +} -- 2.30.2