Commit 61a861e6 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 67689d1a
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));
......
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
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment