Blame SOURCES/gcc34-rh205919.patch

6fdc0f
2006-12-08  Alexandre Oliva  <aoliva@redhat.com>
6fdc0f
6fdc0f
	* g++.dg/template/array17.C: New test.
6fdc0f
6fdc0f
2006-10-27  Alexandre Oliva  <aoliva@redhat.com>
6fdc0f
6fdc0f
	* typeck.c (non_reference): Don't dereference NULL type.
6fdc0f
6fdc0f
--- gcc/cp/typeck.c.orig	2005-11-21 11:56:03.000000000 -0200
6fdc0f
+++ gcc/cp/typeck.c	2006-10-27 03:28:04.000000000 -0300
6fdc0f
@@ -6443,7 +6443,7 @@ casts_away_constness (tree t1, tree t2)
6fdc0f
 tree
6fdc0f
 non_reference (tree t)
6fdc0f
 {
6fdc0f
-  if (TREE_CODE (t) == REFERENCE_TYPE)
6fdc0f
+  if (t != NULL_TREE && TREE_CODE (t) == REFERENCE_TYPE)
6fdc0f
     t = TREE_TYPE (t);
6fdc0f
   return t;
6fdc0f
 }
6fdc0f
--- gcc/testsuite/g++.dg/template/array17.C	2006-10-04 16:28:56.502613000 +0200
6fdc0f
+++ gcc/testsuite/g++.dg/template/array17.C	2006-12-08 12:38:27.000000000 +0100
6fdc0f
@@ -0,0 +1,23 @@
6fdc0f
+// { dg-do compile }
6fdc0f
+
6fdc0f
+template <typename T>
6fdc0f
+struct V {
6fdc0f
+  T& operator[](int);
6fdc0f
+};
6fdc0f
+
6fdc0f
+struct S {
6fdc0f
+  S operator +(int);
6fdc0f
+  template <typename T> T value();
6fdc0f
+};
6fdc0f
+
6fdc0f
+template <typename T>
6fdc0f
+void R (T v)
6fdc0f
+{
6fdc0f
+  v[(S() + 0).template value<int>()][0] = 0;
6fdc0f
+}
6fdc0f
+
6fdc0f
+int
6fdc0f
+main ()
6fdc0f
+{
6fdc0f
+  R(V<V<int> >());
6fdc0f
+}