re PR c++/33495 (Broken diagnostic: Trouble pretty-printing statement expressions)
authorPaolo Carlini <pcarlini@suse.de>
Fri, 2 Nov 2007 14:06:43 +0000 (14:06 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 2 Nov 2007 14:06:43 +0000 (14:06 +0000)
2007-11-02  Paolo Carlini  <pcarlini@suse.de>

PR c++/33495
* error.c (dump_expr): Deal specially with statements.

2007-11-02  Paolo Carlini  <pcarlini@suse.de>

PR c++/33495
* g++.dg/other/error19.C: New.

From-SVN: r129850

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/error19.C [new file with mode: 0644]

index 90bea18d704c6c825f9faae4e54786a1e81149b8..3a90378b97ccc4784a4a731321ae7a3b45d49e6b 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-02  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33495
+       * error.c (dump_expr): Deal specially with statements.
+
 2007-11-01  Jason Merrill  <jason@redhat.com>
 
        PR c++/30897
index 031a22129d7b0b106f083c7e1d3adb693decbf23..49ded5e496b21bf3af4c8eaf7149689f36611282 100644 (file)
@@ -1437,6 +1437,12 @@ dump_expr (tree t, int flags)
   if (t == 0)
     return;
 
+  if (STATEMENT_CLASS_P (t))
+    {
+      pp_cxx_identifier (cxx_pp, "<statement>");
+      return;
+    }
+
   switch (TREE_CODE (t))
     {
     case VAR_DECL:
index 4303ca49c002f8db42062b425bbfdf3a3a52ecff..900d322b384046e5d1eb72fa08eb5987928a8368 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-02  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33495
+       * g++.dg/other/error19.C: New.
+
 2007-11-02  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        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 (file)
index 0000000..9389dc1
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/33495
+
+void foo()
+{
+  if (({while(true);})) // { dg-error "forbids|<statement>" }
+    ;
+}