Blame SOURCES/gcc34-rh205919.patch

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