===================================================================
@@ -0,0 +1,19 @@
+// PR c++/50870
+// { dg-options "-std=gnu++0x" }
+
+struct impl
+{
+ template <class T> static T create();
+};
+
+template<class T, class U,
+ class = decltype(impl::create<T>()->impl::create<U>())>
+struct tester{};
+
+tester<impl*, int> ti;
+
+template<class T, class U,
+ class = decltype(impl::create<T>()->impl::create<U>())>
+int test() { return 0; }
+
+int i = test<impl*, int>();
===================================================================
@@ -8322,7 +8322,7 @@ casts_away_constness (tree t1, tree t2)
tree
non_reference (tree t)
{
- if (TREE_CODE (t) == REFERENCE_TYPE)
+ if (t && TREE_CODE (t) == REFERENCE_TYPE)
t = TREE_TYPE (t);
return t;
}