Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abseil-cpp
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
abseil-cpp
Commits
f39f340c
Commit
f39f340c
authored
May 04, 2023
by
Abseil Team
Committed by
Copybara-Service
May 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Breaks internal code
PiperOrigin-RevId: 529514670 Change-Id: Ia9a19da52f58c91d5131c2a17308a7a322db2714
parent
b2abe7ad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
48 deletions
+0
-48
absl/status/statusor.h
+0
-15
absl/status/statusor_test.cc
+0
-33
No files found.
absl/status/statusor.h
View file @
f39f340c
...
@@ -612,21 +612,6 @@ class StatusOr : private internal_statusor::StatusOrData<T>,
...
@@ -612,21 +612,6 @@ class StatusOr : private internal_statusor::StatusOrData<T>,
return
this
->
data_
;
return
this
->
data_
;
}
}
// StatusOr<T>::AssignStatus()
//
// Sets the status of `absl::StatusOr<T>` to the given non-ok status value.
//
// NOTE: We recommend using the constructor and `operator=` where possible.
// This method is intended for use in generic programming, to enable setting
// the status of a `StatusOr<T>` when `T` may be `Status`. In that case, the
// constructor and `operator=` would assign into the inner value of type
// `Status`, rather than status of the `StatusOr` (b/280392796).
//
// REQUIRES: !Status(std::forward<U>(v)).ok(). This requirement is DCHECKed.
// In optimized builds, passing absl::OkStatus() here will have the effect
// of passing absl::StatusCode::kInternal as a fallback.
using
internal_statusor
::
StatusOrData
<
T
>::
AssignStatus
;
private
:
private
:
using
internal_statusor
::
StatusOrData
<
T
>::
Assign
;
using
internal_statusor
::
StatusOrData
<
T
>::
Assign
;
template
<
typename
U
>
template
<
typename
U
>
...
...
absl/status/statusor_test.cc
View file @
f39f340c
...
@@ -1844,37 +1844,4 @@ TEST(StatusOr, AssignmentFromTypeConvertibleToStatus) {
...
@@ -1844,37 +1844,4 @@ TEST(StatusOr, AssignmentFromTypeConvertibleToStatus) {
}
}
}
}
TEST
(
StatusOr
,
StatusAssignmentFromStatusError
)
{
absl
::
StatusOr
<
absl
::
Status
>
statusor
;
statusor
.
AssignStatus
(
absl
::
CancelledError
());
EXPECT_FALSE
(
statusor
.
ok
());
EXPECT_EQ
(
statusor
.
status
(),
absl
::
CancelledError
());
}
#if GTEST_HAS_DEATH_TEST
TEST
(
StatusOr
,
StatusAssignmentFromStatusOk
)
{
EXPECT_DEBUG_DEATH
(
{
absl
::
StatusOr
<
absl
::
Status
>
statusor
;
// This will DCHECK.
statusor
.
AssignStatus
(
absl
::
OkStatus
());
// In optimized mode, we are actually going to get error::INTERNAL for
// status here, rather than crashing, so check that.
EXPECT_FALSE
(
statusor
.
ok
());
EXPECT_EQ
(
statusor
.
status
().
code
(),
absl
::
StatusCode
::
kInternal
);
},
"An OK status is not a valid constructor argument to StatusOr<T>"
);
}
#endif
TEST
(
StatusOr
,
StatusAssignmentFromTypeConvertibleToStatus
)
{
CustomType
<
MyType
,
kConvToStatus
>
v
;
absl
::
StatusOr
<
MyType
>
statusor
;
statusor
.
AssignStatus
(
v
);
EXPECT_FALSE
(
statusor
.
ok
());
EXPECT_EQ
(
statusor
.
status
(),
static_cast
<
absl
::
Status
>
(
v
));
}
}
// namespace
}
// namespace
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