------- Comment #4 from bangerth at dealii dot org  2006-08-10 21:25 -------
I may not be the only one wondering whether this dynamic_cast<void*>(p) is
valid code at all. To this end, it may be worth noting section 5.2.7/1 
of the standard:

1 The result of the  expression  dynamic_cast<T>(v)  is  the  result  of
  converting  the  expression  v  to  type  T.   T shall be a pointer or
  reference to a complete class type, or "pointer to  cv  void".  [...]

and in 5.2.7/7:

7 If T is "pointer to cv void," then the result is a pointer to the most
  derived object pointed to  by  v.   Otherwise,  a  run-time  check  is
  applied  to  see  if  the  object  pointed  or referred to by v can be
  converted to the type pointed or referred to by T.

It pretty much follows that, indeed, the conversion to a pointer to the most
derived object is supposed to happen without any run-time checks involving
RTTI.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28687

Reply via email to