Victor Chang | 7322950 | 2020-09-17 13:39:19 +0100 | [diff] [blame] | 1 | // © 2016 and later: Unicode, Inc. and others. |
| 2 | // License & terms of use: http://www.unicode.org/copyright.html |
| 3 | /* |
| 4 | ****************************************************************************** |
| 5 | * |
| 6 | * Copyright (C) 2012-2016, International Business Machines |
| 7 | * Corporation and others. All Rights Reserved. |
| 8 | * |
| 9 | ****************************************************************************** |
| 10 | */ |
| 11 | |
| 12 | #ifndef __UTYPEINFO_H__ |
| 13 | #define __UTYPEINFO_H__ |
| 14 | |
| 15 | // Windows header <typeinfo> does not define 'exception' in 'std' namespace. |
| 16 | // Therefore, a project using ICU cannot be compiled with _HAS_EXCEPTIONS |
| 17 | // set to 0 on Windows with Visual Studio. To work around that, we have to |
| 18 | // include <exception> explicitly and add using statement below. |
| 19 | // Whenever 'typeid' is used, this header has to be included |
| 20 | // instead of <typeinfo>. |
| 21 | // Visual Studio 10 emits warning 4275 with this change. If you compile |
| 22 | // with exception disabled, you have to suppress warning 4275. |
| 23 | #if defined(_MSC_VER) && _HAS_EXCEPTIONS == 0 |
| 24 | #include <exception> |
| 25 | using std::exception; |
| 26 | #endif |
| 27 | #if defined(__GLIBCXX__) |
| 28 | namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364 |
| 29 | #endif |
| 30 | #include <typeinfo> // for 'typeid' to work |
| 31 | |
| 32 | #endif |