This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14263] [3.3/3.4/3.5 Regression] Cryptic diagnostic for cast from virtual base class not using dynamic_cast


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-03-01 02:16 -------
The new diagnostic is arguably better than the old: it gives you the hint that
the problem is that A is virtual.  Talking about static_cast would be fine, but
it's easy to see that the static_cast is causing the conversion.  The biggest
problem here is that "via virtual base A" is silly when "A" is a virtual base --
a better message would be:

  cannot convert from `A*' to `B*' because `A' is virtual base of `B'

Talking about dynamic_cast is confusing because that will lead people to use
dynamic_cast even in situations where its use is not appropriate.  It may be
that the user meant to cast "A*" to a base of "A", but instead used a class
derived from "A".

I'm reclassifying this as an enhancement request to fix the "via virtual base"
language.  

I would disapprove a patch to change the wording to match the suggested wording
in Comment #1.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
   Target Milestone|3.3.4                       |---


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]