2006-01-22 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/10891
* rtti.c (build_dynamic_cast): Reject dynamic_cast use if
-fno-rtti.
testsuite/
2006-01-22 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/10891
* g++.dg/rtti/no-rtti.C: New.
From-SVN: r110092
+2006-01-22 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/10891
+ * rtti.c (build_dynamic_cast): Reject dynamic_cast use if
+ -fno-rtti.
+
2006-01-21 Mark Mitchell <mark@codesourcery.com>
PR c++/25895
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
+ /* Use of dynamic_cast when -fno-rtti is a disaster waiting to happen.
+ See PR C++/10891. Reject. */
+ if (!flag_rtti)
+ {
+ error ("%<dynamic_cast%> not permitted with -fno-rtti");
+ return error_mark_node;
+ }
+
if (processing_template_decl)
{
expr = build_min (DYNAMIC_CAST_EXPR, type, expr);
+2006-01-22 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/10891
+ * g++.dg/rtti/no-rtti.C: New.
+
2006-01-21 Mark Mitchell <mark@codesourcery.com>
PR c++/25895
--- /dev/null
+// { dg-do compile }
+// { dg-options "-fno-rtti" }
+
+// PR C++/10891
+
+struct A {
+ virtual ~A() { }
+};
+
+struct B : A {
+};
+
+A* f();
+
+int main()
+{
+ B* b = dynamic_cast<B*>(f()); // { dg-error "error: " }
+}