Skip to content

Conversation

@CaseyCarter
Copy link
Contributor

@CaseyCarter CaseyCarter commented Oct 9, 2020

When _CONTAINER_DEBUG_LEVEL is 1 (which is implied by _ITERATOR_DEBUG_LEVEL != 0) optional::operator* and optional::operator-> verify the precondition that the optional is not empty.

Drive-by: Add a default constructor to death_test_executive so we need not construct with a do-nothing function when there are no "normal" tests.

Partially addresses #1359.

When `_CONTAINER_DEBUG_LEVEL` is `1` (which is implied by `_ITERATOR_DEBUG_LEVEL != 0`) `optional::operator*` and `optional::operator->` verify the precondition that the `optional` is not empty.

Drive-by: Add a default constructor to `death_test_executive` so we need not construct with a do-nothing function when there are no "normal" tests.
@CaseyCarter CaseyCarter added the enhancement Something can be improved label Oct 9, 2020
@CaseyCarter CaseyCarter requested a review from a team as a code owner October 9, 2020 05:04
Copy link
Contributor

@miscco miscco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 👍

@tiagomacarios
Copy link
Member

LGTM

@MikeGitb
Copy link

MikeGitb commented Oct 9, 2020

I'm not understanding the STL good enough to give a review, but I like the feature.

@CaseyCarter CaseyCarter linked an issue Oct 9, 2020 that may be closed by this pull request
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
@CaseyCarter CaseyCarter self-assigned this Oct 13, 2020
@CaseyCarter CaseyCarter merged commit e7d5113 into microsoft:master Oct 13, 2020
@CaseyCarter CaseyCarter deleted the mandatory branch October 13, 2020 04:30
@CaseyCarter CaseyCarter removed their assignment Oct 13, 2020
fengjixuchui added a commit to fengjixuchui/STL that referenced this pull request Oct 13, 2020
Add _CONTAINER_DEBUG_LEVEL checks for optional (microsoft#1362)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

std::optional - unchecked deref security concern <optional>: Should optional::operator* trigger a debug assert if there is no value?

6 participants