From 5b717f34399a1cd2819c89a9501bcd674b58c3c8 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Wed, 4 Jan 2017 23:57:25 +0000 Subject: [PATCH] [gtest] The way EXPECT_TEST now works after upgrading gtest triggers an ODR use. These traits don't have a definition as they're intended to be used strictly at compile time. Change the tests to use static_assert to move the entire thing into compile-time. llvm-svn: 291036 --- clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp index 67a4a3b2fc09..5957c7fa41da 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp @@ -222,9 +222,12 @@ TEST(HasDeclaration, HasDeclarationOfEnumType) { } TEST(HasDeclaration, HasGetDeclTraitTest) { - EXPECT_TRUE(internal::has_getDecl::value); - EXPECT_TRUE(internal::has_getDecl::value); - EXPECT_FALSE(internal::has_getDecl::value); + static_assert(internal::has_getDecl::value, + "Expected TypedefType to have a getDecl."); + static_assert(internal::has_getDecl::value, + "Expected RecordType to have a getDecl."); + static_assert(!internal::has_getDecl::value, + "Expected TemplateSpecializationType to *not* have a getDecl."); } TEST(HasDeclaration, HasDeclarationOfTypeWithDecl) {