diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-06-14 09:22:03 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-06-14 09:22:03 +0000 |
commit | 2388b0953d3b9070b19532b2a0f276f13e15610c (patch) | |
tree | 25ead3d0a0e22f49b61c9a05056f6044b7d9c21f /gcc/cp/rtti.c | |
parent | 64f157140a94e85c0688112948eaa2bc2a775e46 (diff) | |
download | gcc-2388b0953d3b9070b19532b2a0f276f13e15610c.tar.gz |
/cp
2013-06-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57599
* rtti.c (build_dynamic_cast_1): In case of cast to an unambiguous
accessible base simply forward to build_static_cast.
/testsuite
2013-06-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57599
* g++.dg/rtti/dyncast6.C: New.
* g++.dg/cpp0x/dyncast1.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200088 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r-- | gcc/cp/rtti.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 90104406dff..f3094981dfb 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -622,19 +622,10 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain) /* If *type is an unambiguous accessible base class of *exprtype, convert statically. */ { - tree binfo; - - binfo = lookup_base (TREE_TYPE (exprtype), TREE_TYPE (type), - ba_check, NULL, complain); - + tree binfo = lookup_base (TREE_TYPE (exprtype), TREE_TYPE (type), + ba_check, NULL, complain); if (binfo) - { - expr = build_base_path (PLUS_EXPR, convert_from_reference (expr), - binfo, 0, complain); - if (TYPE_PTR_P (exprtype)) - expr = rvalue (expr); - return expr; - } + return build_static_cast (type, expr, complain); } /* Otherwise *exprtype must be a polymorphic class (have a vtbl). */ |