I see a strange failure when dynamic_cast returns NULL in the clang compiler. But the same code works with the gcc environment.
Could you tell me what could be the main reason? What is the difference between dynamic_cast on llvm and gcc.
I use the default behavior for both compilers, where, in my opinion, RTTI is enabled by default.
template<typename T> T* find_msg_of_type( MsgList *list ) { T* msg = NULL; if (list) { for (std::vector<MsgList*>::iterator it = list->element.begin(); it != list->element.end(); it++) {
Another observation: with gcc
if (typeid(*(*it)) == typeid(T))
works fine as expected but with clang
if (typeid(*(*it)) == typeid(T))
comparison shows different behavior. Not sure exactly why this is different.
thanks
Abhrajyoti kirtania
source share