Skip to content

Commit 69c199d

Browse files
author
vladlosev
committed
Teach gtest to autodetect rtti support with clang (by Nico Weber).
git-svn-id: http://googletest.googlecode.com/svn/trunk@614 861a406c-534a-0410-8894-cb66d6ee9925
1 parent 361c8fb commit 69c199d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/gtest/internal/gtest-port.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,13 @@
391391
# define GTEST_HAS_RTTI 0
392392
# endif // __GXX_RTTI
393393

394+
// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends
395+
// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the
396+
// first version with C++ support.
397+
# elif defined(__clang__)
398+
399+
# define GTEST_HAS_RTTI __has_feature(cxx_rtti)
400+
394401
// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
395402
// both the typeid and dynamic_cast features are present.
396403
# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)

0 commit comments

Comments
 (0)