re PR c++/44627 (ICE in dump_expr, at cp/error.c:1735)
authorJakub Jelinek <jakub@redhat.com>
Tue, 22 Jun 2010 20:42:50 +0000 (22:42 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 22 Jun 2010 20:42:50 +0000 (22:42 +0200)
PR c++/44627
* error.c (dump_expr): Don't look at CALL_EXPR_ARG (t, 0) if
the CALL_EXPR has no arguments.

* g++.dg/diagnostic/method1.C: New test.

From-SVN: r161227

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

index 5d36ad3c9778857722802ff4445245c2c84ebb5f..31479189e88cbe8e6b60c03d49bb347258d96c7f 100644 (file)
@@ -1,3 +1,9 @@
+2010-06-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/44627
+       * error.c (dump_expr): Don't look at CALL_EXPR_ARG (t, 0) if
+       the CALL_EXPR has no arguments.
+
 2010-06-21  Jason Merrill  <jason@redhat.com>
 
        * typeck.c (comp_except_specs): Fix ce_derived with noexcept.
index 2cddc6db4b2ccb747e06ae2b5611f41e74494976..1902a135b89870421a6775beae3686bd9e173a9a 100644 (file)
@@ -1759,7 +1759,9 @@ dump_expr (tree t, int flags)
        if (TREE_CODE (fn) == OBJ_TYPE_REF)
          fn = resolve_virtual_fun_from_obj_type_ref (fn);
 
-       if (TREE_TYPE (fn) != NULL_TREE && NEXT_CODE (fn) == METHOD_TYPE)
+       if (TREE_TYPE (fn) != NULL_TREE
+           && NEXT_CODE (fn) == METHOD_TYPE
+           && call_expr_nargs (t))
          {
            tree ob = CALL_EXPR_ARG (t, 0);
            if (TREE_CODE (ob) == ADDR_EXPR)
index 056fd963482aa0ccf3e2b73e0e4851b3207ace7e..a954c9bbe23c965d98585f8824e474231943d0a7 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/44627
+       * g++.dg/diagnostic/method1.C: New test.
+
 2010-06-22  Cary Coutant  <ccoutant@google.com>
 
        * g++.dg/debug/dwarf2/dwarf4-typedef.C: New test.
diff --git a/gcc/testsuite/g++.dg/diagnostic/method1.C b/gcc/testsuite/g++.dg/diagnostic/method1.C
new file mode 100644 (file)
index 0000000..8e1225d
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/44627
+// { dg-do compile }
+
+struct A
+{
+  A *foo ();
+};
+
+template <class T>
+void
+bar ()
+{
+  A::foo ().anything;  // { dg-error "request for member" }
+}
+
+void
+baz ()
+{
+  bar <int> ();
+}