dynamic_cast<X<T> &> within X<T>::mf(...) doesn't compile

Jason Merrill jason@cygnus.com
Wed Nov 26 02:15:00 GMT 1997


>>>>> Christian Millour <chris@etca.fr> writes:

> The form 
> 	dynamic_cast<Derived<T> const &>(rhs).xxx...
> doesn't compile within a member function of Derived<T>.  As a 

Wed Nov 26 01:11:24 1997  Jason Merrill  <jason@yorick.cygnus.com>

	* rtti.c (build_dynamic_cast): Handle template case here.
	(build_dynamic_cast_1): Not here.

Index: rtti.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/cp/rtti.c,v
retrieving revision 1.46
diff -c -r1.46 rtti.c
*** rtti.c	1997/10/14 18:59:36	1.46
--- rtti.c	1997/11/26 10:07:01
***************
*** 428,442 ****
    enum tree_code ec;
    tree dcast_fn;
  
-   if (type == error_mark_node || expr == error_mark_node)
-     return error_mark_node;
-   
-   if (processing_template_decl)
-     {
-       tree t = build_min (DYNAMIC_CAST_EXPR, type, expr);
-       return t;
-     }
- 
    assert (exprtype != NULL_TREE);
    ec = TREE_CODE (exprtype);
  
--- 428,433 ----
***************
*** 647,652 ****
--- 638,649 ----
  build_dynamic_cast (type, expr)
       tree type, expr;
  {
+   if (type == error_mark_node || expr == error_mark_node)
+     return error_mark_node;
+   
+   if (processing_template_decl)
+     return build_min (DYNAMIC_CAST_EXPR, type, expr);
+ 
    return convert_from_reference (build_dynamic_cast_1 (type, expr));
  }
  



More information about the Gcc-bugs mailing list