summaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-01 10:16:50 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-01 10:16:50 +0000
commit2611e72fa04874492201ceecf57435e6ec8f0874 (patch)
treefd2f0d33bb80e63ed673425f60340bd87354c1ef /gcc/cp/call.c
parent7e4c137d85caf68e3c7d7da73989baae9caab46b (diff)
downloadgcc-2611e72fa04874492201ceecf57435e6ec8f0874.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91559 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c67b16f2537..f8af887a323 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -170,7 +170,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 conversion *implicit_conversion (tree, tree, tree, int);
-static conversion *standard_conversion (tree, tree, tree);
+static conversion *standard_conversion (tree, tree, tree, int);
static conversion *reference_binding (tree, tree, tree, int);
static conversion *build_conv (conversion_kind, tree, conversion *);
static bool is_subseq (conversion *, conversion *);
@@ -583,7 +583,7 @@ strip_top_quals (tree t)
also pass the expression EXPR to convert from. */
static conversion *
-standard_conversion (tree to, tree from, tree expr)
+standard_conversion (tree to, tree from, tree expr, int flags)
{
enum tree_code fcode, tcode;
conversion *conv;
@@ -633,7 +633,7 @@ standard_conversion (tree to, tree from, tree expr)
the standard conversion sequence to perform componentwise
conversion. */
conversion *part_conv = standard_conversion
- (TREE_TYPE (to), TREE_TYPE (from), NULL_TREE);
+ (TREE_TYPE (to), TREE_TYPE (from), NULL_TREE, flags);
if (part_conv)
{
@@ -815,7 +815,8 @@ standard_conversion (tree to, tree from, tree expr)
else if (fcode == VECTOR_TYPE && tcode == VECTOR_TYPE
&& vector_types_convertible_p (from, to))
return build_conv (ck_std, 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 (conv->kind == ck_rvalue)
@@ -1227,7 +1228,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;
@@ -4081,6 +4082,7 @@ check_constructor_callable (tree type, tree expr)
build_tree_list (NULL_TREE, expr),
type,
LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING
+ | LOOKUP_NO_CONVERSION
| LOOKUP_CONSTRUCTOR_CALLABLE);
}