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]

g++ 2.95.2 does not provide useful error message when dynamic_cast fails


According to the code (cp/rtti.c: build_dynamic_cast_1), almost all
errors result in
the same message:
    cannot dynamic_cast `%E' (of type `%#T') to type `%#T
This message is not particularly explanatory. In particular, it took me
a couple
of hours to figure out that a dynamic cast was failing because the type
of the
expr being cast did not have a vtbl. (I figured out the problem only by
looking
at the above gcc source code.)

    Steven



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