[Bug c++/66786] [5/6 Regression] ICE: Segmentation fault
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 8 01:05:00 GMT 2016
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;
More information about the Gcc-bugs
mailing list