aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2019-05-07 16:28:11 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2019-05-07 16:28:11 +0000
commit36069bc4ee1288f00971f4abd45034d7f4d79cee (patch)
tree4cdf7a5c212557bbbacd3dc4a1c6679183dc1db8 /gcc/cp/call.c
parenta417d6541582d183b6b283ab8f7c45a476d7c50a (diff)
downloadgcc-36069bc4ee1288f00971f4abd45034d7f4d79cee.zip
gcc-36069bc4ee1288f00971f4abd45034d7f4d79cee.tar.gz
gcc-36069bc4ee1288f00971f4abd45034d7f4d79cee.tar.bz2
PR c++/89705 - ICE with reference binding with conversion function.
* call.c (reference_binding): If the result of the conversion function is a prvalue of non-class type, use the cv-unqualified type. From-SVN: r270973
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index f66ddfc..4e6d37d 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1767,6 +1767,9 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags,
&& DECL_CONV_FN_P (t->cand->fn))
{
tree ftype = TREE_TYPE (TREE_TYPE (t->cand->fn));
+ /* A prvalue of non-class type is cv-unqualified. */
+ if (TREE_CODE (ftype) != REFERENCE_TYPE && !CLASS_TYPE_P (ftype))
+ ftype = cv_unqualified (ftype);
int sflags = (flags|LOOKUP_NO_CONVERSION)&~LOOKUP_NO_TEMP_BIND;
conversion *new_second
= reference_binding (rto, ftype, NULL_TREE, c_cast_p,