[LLVMbugs] [Bug 13153] New: clang can't parse <exception> if _HAS_EXCEPTIONS is defined to 0 on windows

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 19 16:40:02 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13153

             Bug #: 13153
           Summary: clang can't parse <exception> if _HAS_EXCEPTIONS is
                    defined to 0 on windows
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


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.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list