re PR c++/34364 (class& is not known as as a class-type anymore after dynamic_cast)
PR c++/34364 * rtti.c (build_dynamic_cast): Call convert_from_reference even for dynamic_cast in a template. * g++.dg/rtti/dyncast2.C: New test. From-SVN: r130770
This commit is contained in:
parent
67689d1ad6
commit
61a861e686
4 changed files with 43 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-12-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/34364
|
||||
* rtti.c (build_dynamic_cast): Call convert_from_reference even for
|
||||
dynamic_cast in a template.
|
||||
|
||||
2007-12-10 Simon Martin <simartin@users.sourceforge.net>
|
||||
|
||||
PR c++/34059
|
||||
|
|
|
@ -728,8 +728,7 @@ build_dynamic_cast (tree type, tree expr)
|
|||
{
|
||||
expr = build_min (DYNAMIC_CAST_EXPR, type, expr);
|
||||
TREE_SIDE_EFFECTS (expr) = 1;
|
||||
|
||||
return expr;
|
||||
return convert_from_reference (expr);
|
||||
}
|
||||
|
||||
return convert_from_reference (build_dynamic_cast_1 (type, expr));
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2007-12-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/34364
|
||||
* g++.dg/rtti/dyncast2.C: New test.
|
||||
|
||||
2007-12-11 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR tree-optimization/34407
|
||||
|
|
31
gcc/testsuite/g++.dg/rtti/dyncast2.C
Normal file
31
gcc/testsuite/g++.dg/rtti/dyncast2.C
Normal file
|
@ -0,0 +1,31 @@
|
|||
// PR c++/34364
|
||||
// { dg-do run }
|
||||
|
||||
struct A
|
||||
{
|
||||
virtual ~A () {}
|
||||
};
|
||||
|
||||
struct B : public A
|
||||
{
|
||||
template <typename T> struct C
|
||||
{
|
||||
static void f (A &a)
|
||||
{
|
||||
dynamic_cast <B &>(a).g ();
|
||||
}
|
||||
};
|
||||
|
||||
B () : c (6) {}
|
||||
void g () { c++; }
|
||||
int c;
|
||||
};
|
||||
|
||||
B b;
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
B::C<int>::f (b);
|
||||
return b.c != 7;
|
||||
}
|
Loading…
Add table
Reference in a new issue