From: Nathan Sidwell Date: Wed, 1 Dec 2004 12:58:17 +0000 (+0000) Subject: re PR c++/17431 (Internal error: Segmentation fault (program cc1plus)) X-Git-Tag: releases/gcc-3.4.4~469 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9b64c31934a1232c5390da251a9f95b9fc9007f;p=thirdparty%2Fgcc.git re PR c++/17431 (Internal error: Segmentation fault (program cc1plus)) cp: PR c++/17431 * call.c (standard_conversion): Add FLAGS parameter. Do not allow derived to base conversion when checking constructor accessibility. (implicit_conversion): Pass FLAGS to standard_conversion. (check_constructir_callable): Disallow conversion functions. testsuite: PR c++/17431 * g++.dg/overload/arg1.C: New. * g++.dg/overload/arg2.C: New. * g++.dg/overload/arg3.C: New. * g++.dg/overload/arg4.C: New. From-SVN: r91561 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ae4327db45ea..d9f79a8feba9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2004-12-01 Nathan Sidwell + + PR c++/17431 + * call.c (standard_conversion): Add FLAGS parameter. Do not allow + derived to base conversion when checking constructor + accessibility. + (implicit_conversion): Pass FLAGS to standard_conversion. + (check_constructir_callable): Disallow conversion functions. + 2004-11-12 Mark Mitchell PR c++/18389 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index c4a09baa2339..5114af79f0c1 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -86,7 +86,7 @@ static struct z_candidate *add_conv_candidate static struct z_candidate *add_function_candidate (struct z_candidate **, tree, tree, tree, tree, tree, int); static tree implicit_conversion (tree, tree, tree, int); -static tree standard_conversion (tree, tree, tree); +static tree standard_conversion (tree, tree, tree, int); static tree reference_binding (tree, tree, tree, int); static tree build_conv (enum tree_code, tree, tree); static bool is_subseq (tree, tree); @@ -454,7 +454,7 @@ strip_top_quals (tree t) also pass the expression EXPR to convert from. */ static tree -standard_conversion (tree to, tree from, tree expr) +standard_conversion (tree to, tree from, tree expr, int flags) { enum tree_code fcode, tcode; tree conv; @@ -505,7 +505,7 @@ standard_conversion (tree to, tree from, tree expr) the standard conversion sequence to perform componentwise conversion. */ tree part_conv = standard_conversion - (TREE_TYPE (to), TREE_TYPE (from), NULL_TREE); + (TREE_TYPE (to), TREE_TYPE (from), NULL_TREE, flags); if (part_conv) { @@ -692,7 +692,8 @@ standard_conversion (tree to, tree from, tree expr) && ((*targetm.vector_opaque_p) (from) || (*targetm.vector_opaque_p) (to))) return build_conv (STD_CONV, to, conv); - else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from) + else if (!(flags & LOOKUP_CONSTRUCTOR_CALLABLE) + && IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from) && is_properly_derived_from (from, to)) { if (TREE_CODE (conv) == RVALUE_CONV) @@ -1105,7 +1106,7 @@ implicit_conversion (tree to, tree from, tree expr, int flags) if (TREE_CODE (to) == REFERENCE_TYPE) conv = reference_binding (to, from, expr, flags); else - conv = standard_conversion (to, from, expr); + conv = standard_conversion (to, from, expr, flags); if (conv) return conv; @@ -3878,6 +3879,7 @@ check_constructor_callable (tree type, tree expr) build_tree_list (NULL_TREE, expr), TYPE_BINFO (type), LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING + | LOOKUP_NO_CONVERSION | LOOKUP_CONSTRUCTOR_CALLABLE); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 695af5856509..344b6c6a44ae 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2004-12-01 Nathan Sidwell + + PR c++/17431 + * g++.dg/overload/arg1.C: New. + * g++.dg/overload/arg2.C: New. + * g++.dg/overload/arg3.C: New. + * g++.dg/overload/arg4.C: New. + 2004-11-30 Jakub Jelinek * gcc.c-torture/execute/20041126-1.c: New test.