Skip to content

Nullable::Emplace doesn't set m_hasValue = true #5172

@tudor

Description

@tudor

Describe the bug
Azure::Nullable::Emplace creates an object as m_value but forgets to set m_hasValue = true.

Code Snippet

Azure::Nullable<int> x;
x.Emplace(42);
assert(x.HasValue());

Expected behavior
Emplace should actually engage the Nullable object, just like std::optional::emplace.

Setup (please complete the following information):
The bug still exists in trunk at the time of my writing:

::new (static_cast<void*>(&m_value)) T(std::forward<U>(Args)...);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Azure.CoreClientThis issue points to a problem in the data-plane of the library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-triageWorkflow: This issue needs the team to triage.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions