diff options
author | Jason Merrill <jason@redhat.com> | 2013-07-13 19:10:12 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-07-13 19:10:12 -0400 |
commit | 53db1bc08e4450cb53975377c209ff9cc9bfca9b (patch) | |
tree | e820a3247e286fe0510394ffbfa1ccf945fe62f0 /gcc/cp/call.c | |
parent | e43257e81709a7c2f3d6f08623c1e6331b71a92a (diff) | |
download | gcc-53db1bc08e4450cb53975377c209ff9cc9bfca9b.zip gcc-53db1bc08e4450cb53975377c209ff9cc9bfca9b.tar.gz gcc-53db1bc08e4450cb53975377c209ff9cc9bfca9b.tar.bz2 |
call.c (can_convert): Allow user-defined conversions.
* call.c (can_convert): Allow user-defined conversions.
(can_convert_standard): New.
* cp-tree.h: Declare it.
* cvt.c (convert_to_reference): Use it.
* pt.c (convert_nontype_argument): Likewise.
* search.c (check_final_overrider): Likewise.
Don't worry about user-defined conversions.
From-SVN: r200937
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 78899ab..02daf82 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -8814,6 +8814,20 @@ tourney (struct z_candidate *candidates, tsubst_flags_t complain) bool can_convert (tree to, tree from, tsubst_flags_t complain) { + tree arg = NULL_TREE; + /* implicit_conversion only considers user-defined conversions + if it has an expression for the call argument list. */ + if (CLASS_TYPE_P (from) || CLASS_TYPE_P (to)) + arg = build1 (CAST_EXPR, from, NULL_TREE); + return can_convert_arg (to, from, arg, LOOKUP_IMPLICIT, complain); +} + +/* Returns nonzero if things of type FROM can be converted to TO with a + standard conversion. */ + +bool +can_convert_standard (tree to, tree from, tsubst_flags_t complain) +{ return can_convert_arg (to, from, NULL_TREE, LOOKUP_IMPLICIT, complain); } |