Blame SOURCES/gcc34-rh205919.patch

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