| 2006-12-08 Alexandre Oliva <aoliva@redhat.com> |
| |
| * g++.dg/template/array17.C: New test. |
| |
| 2006-10-27 Alexandre Oliva <aoliva@redhat.com> |
| |
| * typeck.c (non_reference): Don't dereference NULL type. |
| |
| |
| |
| @@ -6443,7 +6443,7 @@ casts_away_constness (tree t1, tree t2) |
| tree |
| non_reference (tree t) |
| { |
| - if (TREE_CODE (t) == REFERENCE_TYPE) |
| + if (t != NULL_TREE && TREE_CODE (t) == REFERENCE_TYPE) |
| t = TREE_TYPE (t); |
| return t; |
| } |
| |
| |
| @@ -0,0 +1,23 @@ |
| +// { dg-do compile } |
| + |
| +template <typename T> |
| +struct V { |
| + T& operator[](int); |
| +}; |
| + |
| +struct S { |
| + S operator +(int); |
| + template <typename T> T value(); |
| +}; |
| + |
| +template <typename T> |
| +void R (T v) |
| +{ |
| + v[(S() + 0).template value<int>()][0] = 0; |
| +} |
| + |
| +int |
| +main () |
| +{ |
| + R(V<V<int> >()); |
| +} |