From 9b5894be395d9d194425214b07ad696504b324b5 Mon Sep 17 00:00:00 2001 From: "a.navrotskiy" Date: Tue, 5 Apr 2016 12:07:38 +0300 Subject: [PATCH 1/2] Fix Visual Studio compilation with _HAS_EXCEPTIONS=0 Bug information: https://connect.microsoft.com/VisualStudio/feedback/details/1600701/type-info-does-not-compile-with-has-exceptions-0 For example: ``` C:\Work\github\cryptopp>cl /c /Tp cryptlib.h /Focryptlib.h.obj /D_HAS_EXCEPTIONS=0 Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86 Copyright (C) Microsoft Corporation. All rights reserved. sha.h c:\work\github\cryptopp\cryptlib.h(292) : error C2039: 'type_info' : is not a member of 'std' c:\work\github\cryptopp\cryptlib.h(298) : error C2039: 'type_info' : is not a member of 'std' c:\work\github\cryptopp\cryptlib.h(302) : error C2039: 'type_info' : is not a member of 'std' c:\work\github\cryptopp\cryptlib.h(305) : error C2039: 'type_info' : is not a member of 'std' c:\work\github\cryptopp\cryptlib.h(306) : error C2039: 'type_info' : is not a member of 'std' c:\work\github\cryptopp\cryptlib.h(392) : error C2039: 'type_info' : is not a member of 'std' c:\work\github\cryptopp\cryptlib.h(437) : error C2039: 'type_info' : is not a member of 'std' ``` --- stdcpp.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stdcpp.h b/stdcpp.h index b7384f29..d54b53ab 100644 --- a/stdcpp.h +++ b/stdcpp.h @@ -6,6 +6,13 @@ #include #endif +#ifdef _MSC_VER +// Workaround for: https://connect.microsoft.com/VisualStudio/feedback/details/1600701/type-info-does-not-compile-with-has-exceptions-0 +namespace std { + using ::type_info; +} +#endif + #include #include #include From ab0f2120f6892811b73c6884f35f63054b56518f Mon Sep 17 00:00:00 2001 From: "a.navrotskiy" Date: Wed, 6 Apr 2016 10:42:04 +0300 Subject: [PATCH 2/2] Fix Visual Studio compilation with _HAS_EXCEPTIONS=0 (more concrete define and better workaround place) --- stdcpp.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/stdcpp.h b/stdcpp.h index d54b53ab..66efc203 100644 --- a/stdcpp.h +++ b/stdcpp.h @@ -6,13 +6,6 @@ #include #endif -#ifdef _MSC_VER -// Workaround for: https://connect.microsoft.com/VisualStudio/feedback/details/1600701/type-info-does-not-compile-with-has-exceptions-0 -namespace std { - using ::type_info; -} -#endif - #include #include #include @@ -27,6 +20,13 @@ namespace std { #include #include +#if defined(_MSC_VER) && (_MSC_VER < 1900) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 0) +// Workaround for: https://connect.microsoft.com/VisualStudio/feedback/details/1600701/type-info-does-not-compile-with-has-exceptions-0 +namespace std { + using ::type_info; +} +#endif + #if _MSC_VER >= 1600 // for make_unchecked_array_iterator #include