* pt.c (dependent_type_p_r): Avoid infinite recursion.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174354
138bc75d-0d04-0410-961f-
82ee72b054a4
2011-05-27 Jason Merrill <jason@redhat.com>
2011-05-27 Jason Merrill <jason@redhat.com>
+ PR c++/47687
+ * pt.c (dependent_type_p_r): Avoid infinite recursion.
+
PR c++/48284
* error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot
with INDIRECT_REF of REFERENCE_TYPE.
PR c++/48284
* error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot
with INDIRECT_REF of REFERENCE_TYPE.
scope = TYPE_CONTEXT (type);
if (scope && TYPE_P (scope))
return dependent_type_p (scope);
scope = TYPE_CONTEXT (type);
if (scope && TYPE_P (scope))
return dependent_type_p (scope);
- else if (scope && TREE_CODE (scope) == FUNCTION_DECL)
- return type_dependent_expression_p (scope);
+ /* Don't use type_dependent_expression_p here, as it can lead
+ to infinite recursion trying to determine whether a lambda
+ nested in a lambda is dependent (c++/47687). */
+ else if (scope && TREE_CODE (scope) == FUNCTION_DECL
+ && DECL_LANG_SPECIFIC (scope)
+ && DECL_TEMPLATE_INFO (scope)
+ && (any_dependent_template_arguments_p
+ (INNERMOST_TEMPLATE_ARGS (DECL_TI_ARGS (scope)))))
+ return true;
/* Other types are non-dependent. */
return false;
/* Other types are non-dependent. */
return false;
2011-05-27 Jason Merrill <jason@redhat.com>
2011-05-27 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/lambda/lambda-nested4.C: New.
+
* g++.dg/cpp0x/error6.C: New.
* g++.dg/cpp0x/error5.C: New.
* g++.dg/cpp0x/error6.C: New.
* g++.dg/cpp0x/error5.C: New.
--- /dev/null
+// PR c++/47687
+// { dg-options -std=c++0x }
+
+template <class T> struct A { };
+
+auto inl = []{ return []{}; }();
+typedef decltype(inl) inlt;
+
+A<inlt> a;