aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-05-27 15:32:07 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-05-27 15:32:07 -0400
commit6d258f3157f2e035d491929a9b819cae3b24a8e9 (patch)
tree245de3ff34e4cbf3807e4e35e972087b8c824419 /gcc/cp/pt.c
parent87fd3cf18a7e5d67bbbf9a96c34c5476544a4eac (diff)
downloadgcc-6d258f3157f2e035d491929a9b819cae3b24a8e9.zip
gcc-6d258f3157f2e035d491929a9b819cae3b24a8e9.tar.gz
gcc-6d258f3157f2e035d491929a9b819cae3b24a8e9.tar.bz2
re PR c++/47687 ([C++0x] Crash on a lambda returning a lambda (using std::function))
PR c++/47687 * pt.c (dependent_type_p_r): Avoid infinite recursion. From-SVN: r174354
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 71fe0a0..ae3d83d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18260,8 +18260,15 @@ dependent_type_p_r (tree type)
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;