Hi, if _HAS_EXCEPTIONS is set to 0, typeid() can't be used in clang on windows. One use case where this happens is ICU in chromium: http://git.chromium.org/gitweb/?p=chromium/deps/icu46.git;a=commitdiff_plain;h=8ad988882c0a6bb2ac66eecab662141110840e66
This is a reduced reproduction that builds fine with MSVC:
#define _HAS_EXCEPTIONS 0
#include <exception>
#include <typeinfo> // for typeid to work.
void f() {
(void)typeid(int); // just typeid
}
clang on the other hand complains about typeid requiring an include
for <typeinfo>. That's because clang tries to look up std::type_info,
and the MS typeinfo header apparently doesn't define type_info in the
std namespace, but only if _HAS_EXCEPTIONS is defined to 0. The
attached patch lets clang look up type_info in the global namespace in
ms compat mode if the lookup for std::type-info fails.
Ok?
Nico
clang-ms-typeinfo.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
