This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66786] [5/6 Regression] ICE: Segmentation fault
- From: "ppalka at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 08 Feb 2016 01:05:12 +0000
- Subject: [Bug c++/66786] [5/6 Regression] ICE: Segmentation fault
- Auto-submitted: auto-generated
- References: <bug-66786-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66786
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Looks like the field LAMBDA_TYPE_EXTRA_SCOPE has what we need. I am testing
this patch:
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 4d405cf..5c344c1 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -369,16 +369,20 @@ template_class_depth (tree type)
{
int depth;
- for (depth = 0;
- type && TREE_CODE (type) != NAMESPACE_DECL;
- type = (TREE_CODE (type) == FUNCTION_DECL)
- ? CP_DECL_CONTEXT (type) : CP_TYPE_CONTEXT (type))
+ for (depth = 0; type && TREE_CODE (type) != NAMESPACE_DECL; )
{
tree tinfo = get_template_info (type);
if (tinfo && PRIMARY_TEMPLATE_P (TI_TEMPLATE (tinfo))
&& uses_template_parms (INNERMOST_TEMPLATE_ARGS (TI_ARGS (tinfo))))
++depth;
+
+ if (VAR_OR_FUNCTION_DECL_P (type))
+ type = CP_DECL_CONTEXT (type);
+ else if (LAMBDA_TYPE_P (type))
+ type = LAMBDA_TYPE_EXTRA_SCOPE (type);
+ else
+ type = CP_TYPE_CONTEXT (type);
}
return depth;