| Index: base/template_util_unittest.cc
|
| diff --git a/base/template_util_unittest.cc b/base/template_util_unittest.cc
|
| index 3ec3887154d89a4fd99033e9d5ca2bd77a2111ae..52b856a87d4c3feef2903b55d82e7878ff57e997 100644
|
| --- a/base/template_util_unittest.cc
|
| +++ b/base/template_util_unittest.cc
|
| @@ -18,23 +18,24 @@ class Parent {};
|
| class Child : public Parent {};
|
|
|
| // is_pointer<Type>
|
| -COMPILE_ASSERT(!is_pointer<int>::value, IsPointer);
|
| -COMPILE_ASSERT(!is_pointer<int&>::value, IsPointer);
|
| -COMPILE_ASSERT(is_pointer<int*>::value, IsPointer);
|
| -COMPILE_ASSERT(is_pointer<const int*>::value, IsPointer);
|
| +static_assert(!is_pointer<int>::value, "IsPointer");
|
| +static_assert(!is_pointer<int&>::value, "IsPointer");
|
| +static_assert( is_pointer<int*>::value, "IsPointer");
|
| +static_assert( is_pointer<const int*>::value, "IsPointer");
|
|
|
| // is_array<Type>
|
| -COMPILE_ASSERT(!is_array<int>::value, IsArray);
|
| -COMPILE_ASSERT(!is_array<int*>::value, IsArray);
|
| -COMPILE_ASSERT(!is_array<int(*)[3]>::value, IsArray);
|
| -COMPILE_ASSERT(is_array<int[]>::value, IsArray);
|
| -COMPILE_ASSERT(is_array<const int[]>::value, IsArray);
|
| -COMPILE_ASSERT(is_array<int[3]>::value, IsArray);
|
| +static_assert(!is_array<int>::value, "IsArray");
|
| +static_assert(!is_array<int*>::value, "IsArray");
|
| +static_assert(!is_array<int (*)[3]>::value, "IsArray");
|
| +static_assert( is_array<int[]>::value, "IsArray");
|
| +static_assert( is_array<const int[]>::value, "IsArray");
|
| +static_assert( is_array<int[3]>::value, "IsArray");
|
|
|
| // is_non_const_reference<Type>
|
| -COMPILE_ASSERT(!is_non_const_reference<int>::value, IsNonConstReference);
|
| -COMPILE_ASSERT(!is_non_const_reference<const int&>::value, IsNonConstReference);
|
| -COMPILE_ASSERT(is_non_const_reference<int&>::value, IsNonConstReference);
|
| +static_assert(!is_non_const_reference<int>::value, "IsNonConstReference");
|
| +static_assert(!is_non_const_reference<const int&>::value,
|
| + "IsNonConstReference");
|
| +static_assert( is_non_const_reference<int&>::value, "IsNonConstReference");
|
|
|
| // is_convertible<From, To>
|
|
|
| @@ -44,66 +45,64 @@ COMPILE_ASSERT(is_non_const_reference<int&>::value, IsNonConstReference);
|
| // (is_convertible < Child), (Parent > ::value)
|
| //
|
| // Silly C++.
|
| -COMPILE_ASSERT( (is_convertible<Child, Parent>::value), IsConvertible);
|
| -COMPILE_ASSERT(!(is_convertible<Parent, Child>::value), IsConvertible);
|
| -COMPILE_ASSERT(!(is_convertible<Parent, AStruct>::value), IsConvertible);
|
| -COMPILE_ASSERT( (is_convertible<int, double>::value), IsConvertible);
|
| -COMPILE_ASSERT( (is_convertible<int*, void*>::value), IsConvertible);
|
| -COMPILE_ASSERT(!(is_convertible<void*, int*>::value), IsConvertible);
|
| +static_assert( (is_convertible<Child, Parent>::value), "IsConvertible");
|
| +static_assert(!(is_convertible<Parent, Child>::value), "IsConvertible");
|
| +static_assert(!(is_convertible<Parent, AStruct>::value), "IsConvertible");
|
| +static_assert( (is_convertible<int, double>::value), "IsConvertible");
|
| +static_assert( (is_convertible<int*, void*>::value), "IsConvertible");
|
| +static_assert(!(is_convertible<void*, int*>::value), "IsConvertible");
|
|
|
| // Array types are an easy corner case. Make sure to test that
|
| // it does indeed compile.
|
| -COMPILE_ASSERT(!(is_convertible<int[10], double>::value), IsConvertible);
|
| -COMPILE_ASSERT(!(is_convertible<double, int[10]>::value), IsConvertible);
|
| -COMPILE_ASSERT( (is_convertible<int[10], int*>::value), IsConvertible);
|
| +static_assert(!(is_convertible<int[10], double>::value), "IsConvertible");
|
| +static_assert(!(is_convertible<double, int[10]>::value), "IsConvertible");
|
| +static_assert( (is_convertible<int[10], int*>::value), "IsConvertible");
|
|
|
| // is_same<Type1, Type2>
|
| -COMPILE_ASSERT(!(is_same<Child, Parent>::value), IsSame);
|
| -COMPILE_ASSERT(!(is_same<Parent, Child>::value), IsSame);
|
| -COMPILE_ASSERT( (is_same<Parent, Parent>::value), IsSame);
|
| -COMPILE_ASSERT( (is_same<int*, int*>::value), IsSame);
|
| -COMPILE_ASSERT( (is_same<int, int>::value), IsSame);
|
| -COMPILE_ASSERT( (is_same<void, void>::value), IsSame);
|
| -COMPILE_ASSERT(!(is_same<int, double>::value), IsSame);
|
| -
|
| +static_assert(!(is_same<Child, Parent>::value), "IsSame");
|
| +static_assert(!(is_same<Parent, Child>::value), "IsSame");
|
| +static_assert( (is_same<Parent, Parent>::value), "IsSame");
|
| +static_assert( (is_same<int*, int*>::value), "IsSame");
|
| +static_assert( (is_same<int, int>::value), "IsSame");
|
| +static_assert( (is_same<void, void>::value), "IsSame");
|
| +static_assert(!(is_same<int, double>::value), "IsSame");
|
|
|
| // is_class<Type>
|
| -COMPILE_ASSERT(is_class<AStruct>::value, IsClass);
|
| -COMPILE_ASSERT(is_class<AClass>::value, IsClass);
|
| -COMPILE_ASSERT(!is_class<AnEnum>::value, IsClass);
|
| -COMPILE_ASSERT(!is_class<int>::value, IsClass);
|
| -COMPILE_ASSERT(!is_class<char*>::value, IsClass);
|
| -COMPILE_ASSERT(!is_class<int&>::value, IsClass);
|
| -COMPILE_ASSERT(!is_class<char[3]>::value, IsClass);
|
| -
|
| -
|
| -COMPILE_ASSERT(!is_member_function_pointer<int>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(!is_member_function_pointer<int*>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(!is_member_function_pointer<void*>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(!is_member_function_pointer<AStruct>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(!is_member_function_pointer<AStruct*>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(!is_member_function_pointer<void(*)()>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(!is_member_function_pointer<int(*)(int)>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(!is_member_function_pointer<int(*)(int, int)>::value,
|
| - IsMemberFunctionPointer);
|
| -
|
| -COMPILE_ASSERT(is_member_function_pointer<void (AStruct::*)()>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(is_member_function_pointer<void (AStruct::*)(int)>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(is_member_function_pointer<int (AStruct::*)(int)>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(is_member_function_pointer<int (AStruct::*)(int) const>::value,
|
| - IsMemberFunctionPointer);
|
| -COMPILE_ASSERT(is_member_function_pointer<int (AStruct::*)(int, int)>::value,
|
| - IsMemberFunctionPointer);
|
| +static_assert( is_class<AStruct>::value, "IsClass");
|
| +static_assert( is_class<AClass>::value, "IsClass");
|
| +static_assert(!is_class<AnEnum>::value, "IsClass");
|
| +static_assert(!is_class<int>::value, "IsClass");
|
| +static_assert(!is_class<char*>::value, "IsClass");
|
| +static_assert(!is_class<int&>::value, "IsClass");
|
| +static_assert(!is_class<char[3]>::value, "IsClass");
|
| +
|
| +static_assert(!is_member_function_pointer<int>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(!is_member_function_pointer<int*>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(!is_member_function_pointer<void*>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(!is_member_function_pointer<AStruct>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(!is_member_function_pointer<AStruct*>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(!is_member_function_pointer<void (*)()>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(!is_member_function_pointer<int (*)(int)>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(!is_member_function_pointer<int (*)(int, int)>::value,
|
| + "IsMemberFunctionPointer");
|
| +
|
| +static_assert(is_member_function_pointer<void (AStruct::*)()>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(is_member_function_pointer<void (AStruct::*)(int)>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(is_member_function_pointer<int (AStruct::*)(int)>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(is_member_function_pointer<int (AStruct::*)(int) const>::value,
|
| + "IsMemberFunctionPointer");
|
| +static_assert(is_member_function_pointer<int (AStruct::*)(int, int)>::value,
|
| + "IsMemberFunctionPointer");
|
|
|
| } // namespace
|
| } // namespace base
|
|
|