Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
da76d01b
Commit
da76d01b
authored
Aug 14, 2019
by
Krystian Kuzniarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove a custom implementation of std::is_reference
parent
90a443f9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
16 deletions
+6
-16
gmock-actions.h
googlemock/include/gmock/gmock-actions.h
+4
-4
gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+1
-1
gmock-more-actions.h
googlemock/include/gmock/gmock-more-actions.h
+1
-1
gmock-internal-utils.h
googlemock/include/gmock/internal/gmock-internal-utils.h
+0
-4
gmock-internal-utils_test.cc
googlemock/test/gmock-internal-utils_test.cc
+0
-6
No files found.
googlemock/include/gmock/gmock-actions.h
View file @
da76d01b
...
@@ -532,7 +532,7 @@ class ReturnAction {
...
@@ -532,7 +532,7 @@ class ReturnAction {
// in the Impl class. But both definitions must be the same.
// in the Impl class. But both definitions must be the same.
typedef
typename
Function
<
F
>::
Result
Result
;
typedef
typename
Function
<
F
>::
Result
Result
;
GTEST_COMPILE_ASSERT_
(
GTEST_COMPILE_ASSERT_
(
!
is_reference
<
Result
>::
value
,
!
std
::
is_reference
<
Result
>::
value
,
use_ReturnRef_instead_of_Return_to_return_a_reference
);
use_ReturnRef_instead_of_Return_to_return_a_reference
);
static_assert
(
!
std
::
is_void
<
Result
>::
value
,
static_assert
(
!
std
::
is_void
<
Result
>::
value
,
"Can't use Return() on an action expected to return `void`."
);
"Can't use Return() on an action expected to return `void`."
);
...
@@ -561,7 +561,7 @@ class ReturnAction {
...
@@ -561,7 +561,7 @@ class ReturnAction {
Result
Perform
(
const
ArgumentTuple
&
)
override
{
return
value_
;
}
Result
Perform
(
const
ArgumentTuple
&
)
override
{
return
value_
;
}
private
:
private
:
GTEST_COMPILE_ASSERT_
(
!
is_reference
<
Result
>::
value
,
GTEST_COMPILE_ASSERT_
(
!
std
::
is_reference
<
Result
>::
value
,
Result_cannot_be_a_reference_type
);
Result_cannot_be_a_reference_type
);
// We save the value before casting just in case it is being cast to a
// We save the value before casting just in case it is being cast to a
// wrapper type.
// wrapper type.
...
@@ -640,7 +640,7 @@ class ReturnRefAction {
...
@@ -640,7 +640,7 @@ class ReturnRefAction {
// Asserts that the function return type is a reference. This
// Asserts that the function return type is a reference. This
// catches the user error of using ReturnRef(x) when Return(x)
// catches the user error of using ReturnRef(x) when Return(x)
// should be used, and generates some helpful error message.
// should be used, and generates some helpful error message.
GTEST_COMPILE_ASSERT_
(
internal
::
is_reference
<
Result
>::
value
,
GTEST_COMPILE_ASSERT_
(
std
::
is_reference
<
Result
>::
value
,
use_Return_instead_of_ReturnRef_to_return_a_value
);
use_Return_instead_of_ReturnRef_to_return_a_value
);
return
Action
<
F
>
(
new
Impl
<
F
>
(
ref_
));
return
Action
<
F
>
(
new
Impl
<
F
>
(
ref_
));
}
}
...
@@ -687,7 +687,7 @@ class ReturnRefOfCopyAction {
...
@@ -687,7 +687,7 @@ class ReturnRefOfCopyAction {
// catches the user error of using ReturnRefOfCopy(x) when Return(x)
// catches the user error of using ReturnRefOfCopy(x) when Return(x)
// should be used, and generates some helpful error message.
// should be used, and generates some helpful error message.
GTEST_COMPILE_ASSERT_
(
GTEST_COMPILE_ASSERT_
(
internal
::
is_reference
<
Result
>::
value
,
std
::
is_reference
<
Result
>::
value
,
use_Return_instead_of_ReturnRefOfCopy_to_return_a_value
);
use_Return_instead_of_ReturnRefOfCopy_to_return_a_value
);
return
Action
<
F
>
(
new
Impl
<
F
>
(
value_
));
return
Action
<
F
>
(
new
Impl
<
F
>
(
value_
));
}
}
...
...
googlemock/include/gmock/gmock-matchers.h
View file @
da76d01b
...
@@ -280,7 +280,7 @@ class SafeMatcherCastImpl {
...
@@ -280,7 +280,7 @@ class SafeMatcherCastImpl {
// Enforce that we are not converting a non-reference type T to a reference
// Enforce that we are not converting a non-reference type T to a reference
// type U.
// type U.
GTEST_COMPILE_ASSERT_
(
GTEST_COMPILE_ASSERT_
(
internal
::
is_reference
<
T
>::
value
||
!
internal
::
is_reference
<
U
>::
value
,
std
::
is_reference
<
T
>::
value
||
!
std
::
is_reference
<
U
>::
value
,
cannot_convert_non_reference_arg_to_reference
);
cannot_convert_non_reference_arg_to_reference
);
// In case both T and U are arithmetic types, enforce that the
// In case both T and U are arithmetic types, enforce that the
// conversion is not lossy.
// conversion is not lossy.
...
...
googlemock/include/gmock/gmock-more-actions.h
View file @
da76d01b
...
@@ -105,7 +105,7 @@ ACTION_TEMPLATE(SetArgReferee,
...
@@ -105,7 +105,7 @@ ACTION_TEMPLATE(SetArgReferee,
// Ensures that argument #k is a reference. If you get a compiler
// Ensures that argument #k is a reference. If you get a compiler
// error on the next line, you are using SetArgReferee<k>(value) in
// error on the next line, you are using SetArgReferee<k>(value) in
// a mock function whose k-th (0-based) argument is not a reference.
// a mock function whose k-th (0-based) argument is not a reference.
GTEST_COMPILE_ASSERT_
(
internal
::
is_reference
<
argk_type
>::
value
,
GTEST_COMPILE_ASSERT_
(
std
::
is_reference
<
argk_type
>::
value
,
SetArgReferee_must_be_used_with_a_reference_argument
);
SetArgReferee_must_be_used_with_a_reference_argument
);
::
std
::
get
<
k
>
(
args
)
=
value
;
::
std
::
get
<
k
>
(
args
)
=
value
;
}
}
...
...
googlemock/include/gmock/internal/gmock-internal-utils.h
View file @
da76d01b
...
@@ -355,10 +355,6 @@ GTEST_API_ WithoutMatchers GetWithoutMatchers();
...
@@ -355,10 +355,6 @@ GTEST_API_ WithoutMatchers GetWithoutMatchers();
// Type traits.
// Type traits.
// is_reference<T>::value is non-zero if T is a reference type.
template
<
typename
T
>
struct
is_reference
:
public
false_type
{};
template
<
typename
T
>
struct
is_reference
<
T
&>
:
public
true_type
{};
// type_equals<T1, T2>::value is non-zero if T1 and T2 are the same type.
// type_equals<T1, T2>::value is non-zero if T1 and T2 are the same type.
template
<
typename
T1
,
typename
T2
>
struct
type_equals
:
public
false_type
{};
template
<
typename
T1
,
typename
T2
>
struct
type_equals
:
public
false_type
{};
template
<
typename
T
>
struct
type_equals
<
T
,
T
>
:
public
true_type
{};
template
<
typename
T
>
struct
type_equals
<
T
,
T
>
:
public
true_type
{};
...
...
googlemock/test/gmock-internal-utils_test.cc
View file @
da76d01b
...
@@ -512,12 +512,6 @@ TEST(TypeTraitsTest, false_type) {
...
@@ -512,12 +512,6 @@ TEST(TypeTraitsTest, false_type) {
EXPECT_FALSE
(
false_type
::
value
);
EXPECT_FALSE
(
false_type
::
value
);
}
}
TEST
(
TypeTraitsTest
,
is_reference
)
{
EXPECT_FALSE
(
is_reference
<
int
>::
value
);
EXPECT_FALSE
(
is_reference
<
char
*>::
value
);
EXPECT_TRUE
(
is_reference
<
const
int
&>::
value
);
}
TEST
(
TypeTraitsTest
,
type_equals
)
{
TEST
(
TypeTraitsTest
,
type_equals
)
{
EXPECT_FALSE
((
type_equals
<
int
,
const
int
>::
value
));
EXPECT_FALSE
((
type_equals
<
int
,
const
int
>::
value
));
EXPECT_FALSE
((
type_equals
<
int
,
int
&>::
value
));
EXPECT_FALSE
((
type_equals
<
int
,
int
&>::
value
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment