[Bug c++/92705] [10 Regression] ICE: Segmentation fault (in build_new_op_1)
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 29 11:38:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92705
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The ICE is because conv is ck_ambig with user_conv_p set.
Looking at other conv->user_conv_p tests, e.g. reference_binding does:
if (conv->user_conv_p)
{
...
for (conversion *t = conv; t; t = next_conversion (t))
if (t->kind == ck_user
&& DECL_CONV_FN_P (t->cand->fn))
{
and doesn't expect that user_conv_p implies that ck_user will appear.
The following patch restores the previous diagnostics on the testcase, but I'm
afraid I have no idea what is right. If ck_ambig with user_conv_p set is
right, then it itself isn't ck_user and next_conversion on it is NULL.
--- gcc/cp/call.c.jj 2019-11-28 18:58:55.671297387 +0100
+++ gcc/cp/call.c 2019-11-29 12:33:04.033386816 +0100
@@ -6370,8 +6370,12 @@ build_new_op_1 (const op_location_t &loc
conv = cand->convs[0];
if (conv->user_conv_p)
{
- while (conv->kind != ck_user)
- conv = next_conversion (conv);
+ for (conversion *t = conv; t; t = next_conversion (t))
+ if (t->kind == ck_user)
+ {
+ conv = t;
+ break;
+ }
arg1 = convert_like (conv, arg1, complain);
}
@@ -6380,8 +6384,12 @@ build_new_op_1 (const op_location_t &loc
conv = cand->convs[1];
if (conv->user_conv_p)
{
- while (conv->kind != ck_user)
- conv = next_conversion (conv);
+ for (conversion *t = conv; t; t = next_conversion (t))
+ if (t->kind == ck_user)
+ {
+ conv = t;
+ break;
+ }
arg2 = convert_like (conv, arg2, complain);
}
}
@@ -6391,8 +6399,12 @@ build_new_op_1 (const op_location_t &loc
conv = cand->convs[2];
if (conv->user_conv_p)
{
- while (conv->kind != ck_user)
- conv = next_conversion (conv);
+ for (conversion *t = conv; t; t = next_conversion (t))
+ if (t->kind == ck_user)
+ {
+ conv = t;
+ break;
+ }
arg3 = convert_like (conv, arg3, complain);
}
}
More information about the Gcc-bugs
mailing list