Eliminate the legacy GTEST_COMPILE_ASSERT_ macro
PiperOrigin-RevId: 443462203 Change-Id: I0c43f981663a7531ff5da4d4be01fb3d6762273d
This commit is contained in:
committed by
Copybara-Service
parent
8ccdb9d56d
commit
b85864c647
@@ -878,17 +878,6 @@ namespace internal {
|
||||
// Secret object, which is what we want.
|
||||
class Secret;
|
||||
|
||||
// The GTEST_COMPILE_ASSERT_ is a legacy macro used to verify that a compile
|
||||
// time expression is true (in new code, use static_assert instead). For
|
||||
// example, you could use it to verify the size of a static array:
|
||||
//
|
||||
// GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES,
|
||||
// names_incorrect_size);
|
||||
//
|
||||
// The second argument to the macro must be a valid C++ identifier. If the
|
||||
// expression is false, compiler will issue an error containing this identifier.
|
||||
#define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg)
|
||||
|
||||
// A helper for suppressing warnings on constant condition. It just
|
||||
// returns 'condition'.
|
||||
GTEST_API_ bool IsTrue(bool condition);
|
||||
|
||||
@@ -7173,28 +7173,26 @@ struct IncompleteType;
|
||||
// Tests that HasDebugStringAndShortDebugString<T>::value is a compile-time
|
||||
// constant.
|
||||
TEST(HasDebugStringAndShortDebugStringTest, ValueIsCompileTimeConstant) {
|
||||
GTEST_COMPILE_ASSERT_(
|
||||
HasDebugStringAndShortDebugString<HasDebugStringMethods>::value,
|
||||
const_true);
|
||||
GTEST_COMPILE_ASSERT_(
|
||||
static_assert(HasDebugStringAndShortDebugString<HasDebugStringMethods>::value,
|
||||
"const_true");
|
||||
static_assert(
|
||||
HasDebugStringAndShortDebugString<InheritsDebugStringMethods>::value,
|
||||
const_true);
|
||||
GTEST_COMPILE_ASSERT_(HasDebugStringAndShortDebugString<
|
||||
const InheritsDebugStringMethods>::value,
|
||||
const_true);
|
||||
GTEST_COMPILE_ASSERT_(
|
||||
"const_true");
|
||||
static_assert(HasDebugStringAndShortDebugString<
|
||||
const InheritsDebugStringMethods>::value,
|
||||
"const_true");
|
||||
static_assert(
|
||||
!HasDebugStringAndShortDebugString<WrongTypeDebugStringMethod>::value,
|
||||
const_false);
|
||||
GTEST_COMPILE_ASSERT_(
|
||||
"const_false");
|
||||
static_assert(
|
||||
!HasDebugStringAndShortDebugString<NotConstDebugStringMethod>::value,
|
||||
const_false);
|
||||
GTEST_COMPILE_ASSERT_(
|
||||
"const_false");
|
||||
static_assert(
|
||||
!HasDebugStringAndShortDebugString<MissingDebugStringMethod>::value,
|
||||
const_false);
|
||||
GTEST_COMPILE_ASSERT_(
|
||||
!HasDebugStringAndShortDebugString<IncompleteType>::value, const_false);
|
||||
GTEST_COMPILE_ASSERT_(!HasDebugStringAndShortDebugString<int>::value,
|
||||
const_false);
|
||||
"const_false");
|
||||
static_assert(!HasDebugStringAndShortDebugString<IncompleteType>::value,
|
||||
"const_false");
|
||||
static_assert(!HasDebugStringAndShortDebugString<int>::value, "const_false");
|
||||
}
|
||||
|
||||
// Tests that HasDebugStringAndShortDebugString<T>::value is true when T has
|
||||
|
||||
Reference in New Issue
Block a user