diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-17 00:17:59 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-17 00:17:59 +0000 |
commit | d32df6a606f8aad5fd32784861f071934ffd3d83 (patch) | |
tree | c40ac826896b3368eb3837dde85eb3dabae7beaf /gcc/cp/cvt.c | |
parent | 10a529ae76fd5fae3853d0896b4509e33c642b36 (diff) | |
download | gcc-d32df6a606f8aad5fd32784861f071934ffd3d83.tar.gz |
PR c++/7478
* cvt.c (convert_to_reference): Allow references as the incoming
type.
PR c++/7478
* g++.dg/template/ref1.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58230 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r-- | gcc/cp/cvt.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 6905a049e45..7e31045a485 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -473,12 +473,13 @@ convert_to_reference (reftype, expr, convtype, flags, decl) tree decl; { register tree type = TYPE_MAIN_VARIANT (TREE_TYPE (reftype)); - register tree intype = TREE_TYPE (expr); + register tree intype; tree rval = NULL_TREE; tree rval_as_conversion = NULL_TREE; int i; - if (TREE_CODE (type) == FUNCTION_TYPE && intype == unknown_type_node) + if (TREE_CODE (type) == FUNCTION_TYPE + && TREE_TYPE (expr) == unknown_type_node) { expr = instantiate_type (type, expr, (flags & LOOKUP_COMPLAIN) @@ -488,6 +489,11 @@ convert_to_reference (reftype, expr, convtype, flags, decl) intype = TREE_TYPE (expr); } + else + { + expr = convert_from_reference (expr); + intype = TREE_TYPE (expr); + } my_friendly_assert (TREE_CODE (intype) != REFERENCE_TYPE, 364); |