aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/rtti.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-10-11 21:42:31 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-10-11 21:42:31 -0400
commitd1522e8f63167d81f6bd77c5d29ffdba2e6fbe86 (patch)
tree52a295c7a10b57d2b3007a653db61008c5031b70 /gcc/cp/rtti.c
parenta4b9dcad0837d3bc03843df6f96e6cb830550af6 (diff)
downloadgcc-d1522e8f63167d81f6bd77c5d29ffdba2e6fbe86.zip
gcc-d1522e8f63167d81f6bd77c5d29ffdba2e6fbe86.tar.gz
gcc-d1522e8f63167d81f6bd77c5d29ffdba2e6fbe86.tar.bz2
re PR c++/62115 (ICE with invalid default argument)
PR c++/62115 * class.c (build_base_path): Preserve rvalueness. * call.c (convert_like_real) [ck_base]: Let convert_to_base handle &/*. * rtti.c (build_dynamic_cast_1): Call convert_to_reference later. From-SVN: r216124
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r--gcc/cp/rtti.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 10cc168..762953b 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -608,10 +608,6 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain)
errstr = _("source is of incomplete class type");
goto fail;
}
-
- /* Apply trivial conversion T -> T& for dereferenced ptrs. */
- expr = convert_to_reference (exprtype, expr, CONV_IMPLICIT,
- LOOKUP_NORMAL, NULL_TREE, complain);
}
/* The dynamic_cast operator shall not cast away constness. */
@@ -631,6 +627,11 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain)
return build_static_cast (type, expr, complain);
}
+ /* Apply trivial conversion T -> T& for dereferenced ptrs. */
+ if (tc == REFERENCE_TYPE)
+ expr = convert_to_reference (exprtype, expr, CONV_IMPLICIT,
+ LOOKUP_NORMAL, NULL_TREE, complain);
+
/* Otherwise *exprtype must be a polymorphic class (have a vtbl). */
if (TYPE_POLYMORPHIC_P (TREE_TYPE (exprtype)))
{