+2010-01-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/42761
+ * semantics.c (finish_decltype_type): Within a template, treat
+ unresolved CALL_EXPR as dependent.
+
2010-01-15 Dodji Seketeli <dodji@redhat.com>
* error.c (dump_template_parms,count_non_default_template_args):
if (type && !type_uses_auto (type))
return type;
+ treat_as_dependent:
type = cxx_make_type (DECLTYPE_TYPE);
DECLTYPE_TYPE_EXPR (type) = expr;
DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (type)
&& (TREE_CODE (TREE_TYPE (target_type)) == FUNCTION_TYPE
|| TREE_CODE (TREE_TYPE (target_type)) == METHOD_TYPE))
type = TREE_TYPE (TREE_TYPE (target_type));
+ else if (processing_template_decl)
+ /* Within a template finish_call_expr doesn't resolve
+ CALL_EXPR_FN, so even though this decltype isn't really
+ dependent let's defer resolving it. */
+ goto treat_as_dependent;
else
sorry ("unable to determine the declared type of expression %<%E%>",
expr);
--- /dev/null
+// PR c++/42761
+// { dg-options "-std=c++0x" }
+
+template<typename _Tp> _Tp* fn();
+
+template <class T> struct A
+{
+ template <class U,
+ class S = decltype(fn<T>())>
+ struct B { };
+};
+
+A<int> a;