+2017-02-15 Jason Merrill <jason@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/79464 - ICE in IPA with omitted constructor parms
+ * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
+ (adjust_clone_args): Adjust.
+ (add_method): Remember omitted parms.
+ * call.c (add_function_candidate): Likewise.
+ * mangle.c (write_method_parms): Likewise.
+ * method.c (ctor_omit_inherited_parms): Return false if there are no
+ parms to omit.
+
2017-02-15 Martin Sebor <msebor@redhat.com>
PR c++/79363
considered in overload resolution. */
if (DECL_CONSTRUCTOR_P (fn))
{
- parmlist = skip_artificial_parms_for (fn, parmlist);
+ if (ctor_omit_inherited_parms (fn))
+ /* Bring back parameters omitted from an inherited ctor. */
+ parmlist = FUNCTION_FIRST_USER_PARMTYPE (DECL_ORIGIN (fn));
+ else
+ parmlist = skip_artificial_parms_for (fn, parmlist);
skip = num_artificial_parms_for (fn);
if (skip > 0 && first_arg != NULL_TREE)
{
if (! DECL_STATIC_FUNCTION_P (method))
parms2 = TREE_CHAIN (parms2);
+ /* Bring back parameters omitted from an inherited ctor. */
+ if (ctor_omit_inherited_parms (fn))
+ parms1 = FUNCTION_FIRST_USER_PARMTYPE (DECL_ORIGIN (fn));
+ if (ctor_omit_inherited_parms (method))
+ parms2 = FUNCTION_FIRST_USER_PARMTYPE (DECL_ORIGIN (method));
+
if (compparms (parms1, parms2)
&& (!DECL_CONV_FN_P (fn)
|| same_type_p (TREE_TYPE (fn_type),
DECL_VINDEX (clone) = NULL_TREE;
}
+ bool ctor_omit_inherited_parms_p = ctor_omit_inherited_parms (clone);
+ if (ctor_omit_inherited_parms_p)
+ gcc_assert (DECL_HAS_IN_CHARGE_PARM_P (clone));
+
/* If there was an in-charge parameter, drop it from the function
type. */
if (DECL_HAS_IN_CHARGE_PARM_P (clone))
if (DECL_HAS_VTT_PARM_P (fn)
&& ! DECL_NEEDS_VTT_PARM_P (clone))
parmtypes = TREE_CHAIN (parmtypes);
- /* If this is subobject constructor or destructor, add the vtt
- parameter. */
+ if (ctor_omit_inherited_parms_p)
+ {
+ /* If we're omitting inherited parms, that just leaves the VTT. */
+ gcc_assert (DECL_NEEDS_VTT_PARM_P (clone));
+ parmtypes = tree_cons (NULL_TREE, vtt_parm_type, void_list_node);
+ }
TREE_TYPE (clone)
= build_method_type_directly (basetype,
TREE_TYPE (TREE_TYPE (clone)),
/* A base constructor inheriting from a virtual base doesn't get the
arguments. */
- if (ctor_omit_inherited_parms (clone))
+ if (ctor_omit_inherited_parms_p)
DECL_CHAIN (DECL_CHAIN (DECL_ARGUMENTS (clone))) = NULL_TREE;
for (parms = DECL_ARGUMENTS (clone); parms; parms = DECL_CHAIN (parms))
decl_parms = TREE_CHAIN (decl_parms),
clone_parms = TREE_CHAIN (clone_parms))
{
+ if (clone_parms == void_list_node)
+ {
+ gcc_assert (decl_parms == clone_parms
+ || ctor_omit_inherited_parms (clone));
+ break;
+ }
+
gcc_assert (same_type_p (TREE_TYPE (decl_parms),
TREE_TYPE (clone_parms)));
break;
}
}
- gcc_assert (!clone_parms);
+ gcc_assert (!clone_parms || clone_parms == void_list_node);
}
}