Hi,

a patchlet for a pretty old ice-on-invalid regression. Tested x86_64-linux.

Ok for mainline?

Thanks,
Paolo.

////////////////
/cp
2011-06-23  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/44625
        * pt.c (tsubst_copy_and_build): Do not use BASELINK_P on a NULL_TREE.

/testsuite
2011-06-23  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/44625
        * g++.dg/template/crash107.C: New.
Index: testsuite/g++.dg/template/crash107.C
===================================================================
--- testsuite/g++.dg/template/crash107.C        (revision 0)
+++ testsuite/g++.dg/template/crash107.C        (revision 0)
@@ -0,0 +1,20 @@
+// PR c++/44625
+// { dg-do compile }
+// { dg-options "" }
+
+template<typename FP_> struct Vec { // { dg-message "note" }
+    Vec& operator^=(Vec& rhs)     {
+        union {
+            struct {FP_ x,y,z;};
+        }; // { dg-error "anonymous struct" }
+        X = y*rhs.z() - z*rhs.y(); // { dg-error "not declared|no member" }
+    }
+    Vec& operator^(Vec& rhs) {
+        return Vec(*this)^=rhs; // { dg-message "required" }
+    }
+};
+Vec<double> v(3,4,12); // { dg-error "no matching" }
+// { dg-message "note" { target *-*-* } 16 }
+Vec<double> V(12,4,3);  // { dg-error "no matching" }
+// { dg-message "note" { target *-*-* } 18 }
+Vec<double> c = v^V;   // { dg-message "required" }
Index: cp/pt.c
===================================================================
--- cp/pt.c     (revision 175328)
+++ cp/pt.c     (working copy)
@@ -13252,6 +13252,9 @@ tsubst_copy_and_build (tree t,
        object_type = TREE_TYPE (object);
 
        member = TREE_OPERAND (t, 1);
+       if (!member)
+         return error_mark_node;
+
        if (BASELINK_P (member))
          member = tsubst_baselink (member,
                                    non_reference (TREE_TYPE (object)),

Reply via email to