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
a1adec79
Commit
a1adec79
authored
Nov 12, 2020
by
Abseil Team
Committed by
Mark Barolak
Nov 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Googletest export
Use a tagged constructor for FlatTuple instead. Some versions of MSVC are getting confused with that constructor and generating invalid code. PiperOrigin-RevId: 342050957
parent
e7ed50fd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
15 deletions
+17
-15
gmock-generated-actions.h
googlemock/include/gmock/gmock-generated-actions.h
+3
-2
gtest-internal.h
googletest/include/gtest/internal/gtest-internal.h
+3
-8
gtest-param-util.h
googletest/include/gtest/internal/gtest-param-util.h
+1
-1
gtest_unittest.cc
googletest/test/gtest_unittest.cc
+10
-4
No files found.
googlemock/include/gmock/gmock-generated-actions.h
View file @
a1adec79
...
@@ -520,7 +520,8 @@ struct InvokeArgumentAction {
...
@@ -520,7 +520,8 @@ struct InvokeArgumentAction {
auto
operator
()(
Args
&&
...
args
)
const
->
decltype
(
internal
::
InvokeArgument
(
auto
operator
()(
Args
&&
...
args
)
const
->
decltype
(
internal
::
InvokeArgument
(
std
::
get
<
index
>
(
std
::
forward_as_tuple
(
std
::
forward
<
Args
>
(
args
)...)),
std
::
get
<
index
>
(
std
::
forward_as_tuple
(
std
::
forward
<
Args
>
(
args
)...)),
std
::
declval
<
const
Params
&>
()...))
{
std
::
declval
<
const
Params
&>
()...))
{
internal
::
FlatTuple
<
Args
&&
...
>
args_tuple
(
std
::
forward
<
Args
>
(
args
)...);
internal
::
FlatTuple
<
Args
&&
...
>
args_tuple
(
FlatTupleConstructTag
{},
std
::
forward
<
Args
>
(
args
)...);
return
params
.
Apply
([
&
](
const
Params
&
...
unpacked_params
)
{
return
params
.
Apply
([
&
](
const
Params
&
...
unpacked_params
)
{
auto
&&
callable
=
args_tuple
.
template
Get
<
index
>
();
auto
&&
callable
=
args_tuple
.
template
Get
<
index
>
();
return
internal
::
InvokeArgument
(
return
internal
::
InvokeArgument
(
...
@@ -564,7 +565,7 @@ template <std::size_t index, typename... Params>
...
@@ -564,7 +565,7 @@ template <std::size_t index, typename... Params>
internal
::
InvokeArgumentAction
<
index
,
typename
std
::
decay
<
Params
>::
type
...
>
internal
::
InvokeArgumentAction
<
index
,
typename
std
::
decay
<
Params
>::
type
...
>
InvokeArgument
(
Params
&&
...
params
)
{
InvokeArgument
(
Params
&&
...
params
)
{
return
{
internal
::
FlatTuple
<
typename
std
::
decay
<
Params
>::
type
...
>
(
return
{
internal
::
FlatTuple
<
typename
std
::
decay
<
Params
>::
type
...
>
(
std
::
forward
<
Params
>
(
params
)...)};
internal
::
FlatTupleConstructTag
{},
std
::
forward
<
Params
>
(
params
)...)};
}
}
#ifdef _MSC_VER
#ifdef _MSC_VER
...
...
googletest/include/gtest/internal/gtest-internal.h
View file @
a1adec79
...
@@ -1285,14 +1285,9 @@ class FlatTuple
...
@@ -1285,14 +1285,9 @@ class FlatTuple
public
:
public
:
FlatTuple
()
=
default
;
FlatTuple
()
=
default
;
template
<
typename
...
Args
,
template
<
typename
...
Args
>
typename
=
typename
std
::
enable_if
<
explicit
FlatTuple
(
FlatTupleConstructTag
tag
,
Args
&&
...
args
)
!
std
::
is_same
<
void
(
FlatTuple
),
void
(
typename
std
::
decay
<
:
FlatTuple
::
FlatTupleBase
(
tag
,
std
::
forward
<
Args
>
(
args
)...)
{}
Args
>::
type
...)
>::
value
&&
(
sizeof
...(
T
)
>=
1
)
>::
type
>
explicit
FlatTuple
(
Args
&&
...
args
)
:
FlatTuple
::
FlatTupleBase
(
FlatTupleConstructTag
{},
std
::
forward
<
Args
>
(
args
)...)
{}
using
FlatTuple
::
FlatTupleBase
::
Apply
;
using
FlatTuple
::
FlatTupleBase
::
Apply
;
using
FlatTuple
::
FlatTupleBase
::
Get
;
using
FlatTuple
::
FlatTupleBase
::
Get
;
...
...
googletest/include/gtest/internal/gtest-param-util.h
View file @
a1adec79
...
@@ -791,7 +791,7 @@ namespace internal {
...
@@ -791,7 +791,7 @@ namespace internal {
template
<
typename
...
Ts
>
template
<
typename
...
Ts
>
class
ValueArray
{
class
ValueArray
{
public
:
public
:
explicit
ValueArray
(
Ts
...
v
)
:
v_
(
std
::
move
(
v
)...)
{}
explicit
ValueArray
(
Ts
...
v
)
:
v_
(
FlatTupleConstructTag
{},
std
::
move
(
v
)...)
{}
template
<
typename
T
>
template
<
typename
T
>
operator
ParamGenerator
<
T
>
()
const
{
// NOLINT
operator
ParamGenerator
<
T
>
()
const
{
// NOLINT
...
...
googletest/test/gtest_unittest.cc
View file @
a1adec79
...
@@ -7555,7 +7555,8 @@ TEST(FlatTuple, Basic) {
...
@@ -7555,7 +7555,8 @@ TEST(FlatTuple, Basic) {
EXPECT_EQ
(
0.0
,
tuple
.
Get
<
1
>
());
EXPECT_EQ
(
0.0
,
tuple
.
Get
<
1
>
());
EXPECT_EQ
(
nullptr
,
tuple
.
Get
<
2
>
());
EXPECT_EQ
(
nullptr
,
tuple
.
Get
<
2
>
());
tuple
=
FlatTuple
<
int
,
double
,
const
char
*>
(
7
,
3.2
,
"Foo"
);
tuple
=
FlatTuple
<
int
,
double
,
const
char
*>
(
testing
::
internal
::
FlatTupleConstructTag
{},
7
,
3.2
,
"Foo"
);
EXPECT_EQ
(
7
,
tuple
.
Get
<
0
>
());
EXPECT_EQ
(
7
,
tuple
.
Get
<
0
>
());
EXPECT_EQ
(
3.2
,
tuple
.
Get
<
1
>
());
EXPECT_EQ
(
3.2
,
tuple
.
Get
<
1
>
());
EXPECT_EQ
(
std
::
string
(
"Foo"
),
tuple
.
Get
<
2
>
());
EXPECT_EQ
(
std
::
string
(
"Foo"
),
tuple
.
Get
<
2
>
());
...
@@ -7573,7 +7574,8 @@ std::string AddIntToString(int i, const std::string& s) {
...
@@ -7573,7 +7574,8 @@ std::string AddIntToString(int i, const std::string& s) {
TEST
(
FlatTuple
,
Apply
)
{
TEST
(
FlatTuple
,
Apply
)
{
using
testing
::
internal
::
FlatTuple
;
using
testing
::
internal
::
FlatTuple
;
FlatTuple
<
int
,
std
::
string
>
tuple
{
5
,
"Hello"
};
FlatTuple
<
int
,
std
::
string
>
tuple
{
testing
::
internal
::
FlatTupleConstructTag
{},
5
,
"Hello"
};
// Lambda.
// Lambda.
EXPECT_TRUE
(
tuple
.
Apply
([](
int
i
,
const
std
::
string
&
s
)
->
bool
{
EXPECT_TRUE
(
tuple
.
Apply
([](
int
i
,
const
std
::
string
&
s
)
->
bool
{
...
@@ -7647,7 +7649,8 @@ TEST(FlatTuple, ConstructorCalls) {
...
@@ -7647,7 +7649,8 @@ TEST(FlatTuple, ConstructorCalls) {
ConstructionCounting
::
Reset
();
ConstructionCounting
::
Reset
();
{
{
ConstructionCounting
elem
;
ConstructionCounting
elem
;
FlatTuple
<
ConstructionCounting
>
tuple
{
elem
};
FlatTuple
<
ConstructionCounting
>
tuple
{
testing
::
internal
::
FlatTupleConstructTag
{},
elem
};
}
}
EXPECT_EQ
(
ConstructionCounting
::
default_ctor_calls
,
1
);
EXPECT_EQ
(
ConstructionCounting
::
default_ctor_calls
,
1
);
EXPECT_EQ
(
ConstructionCounting
::
dtor_calls
,
2
);
EXPECT_EQ
(
ConstructionCounting
::
dtor_calls
,
2
);
...
@@ -7658,7 +7661,10 @@ TEST(FlatTuple, ConstructorCalls) {
...
@@ -7658,7 +7661,10 @@ TEST(FlatTuple, ConstructorCalls) {
// Move construction.
// Move construction.
ConstructionCounting
::
Reset
();
ConstructionCounting
::
Reset
();
{
FlatTuple
<
ConstructionCounting
>
tuple
{
ConstructionCounting
{}};
}
{
FlatTuple
<
ConstructionCounting
>
tuple
{
testing
::
internal
::
FlatTupleConstructTag
{},
ConstructionCounting
{}};
}
EXPECT_EQ
(
ConstructionCounting
::
default_ctor_calls
,
1
);
EXPECT_EQ
(
ConstructionCounting
::
default_ctor_calls
,
1
);
EXPECT_EQ
(
ConstructionCounting
::
dtor_calls
,
2
);
EXPECT_EQ
(
ConstructionCounting
::
dtor_calls
,
2
);
EXPECT_EQ
(
ConstructionCounting
::
copy_ctor_calls
,
0
);
EXPECT_EQ
(
ConstructionCounting
::
copy_ctor_calls
,
0
);
...
...
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