Skip to content

Investigate whether an MSVC warning is a false positive - C26800 - Use of a moved from object: 'accessToken' #5741

Open
@ahsonkhan

Description

@ahsonkhan

Try to create a simple repro of the warning and reach out to vcsig - the folks who own the C++ compiler to verify.

Before, which causes the warning in VS:

try
{
accessToken.ExpiresOn = parse(expiresOnAsString);
return accessToken;
}
catch (std::exception const&)
{
// parse() has thrown, we may throw later.
}

After, to workaround the warning:

try
{
accessToken.ExpiresOn = parse(expiresOnAsString);
// Workaround for Warning C26800 - Use of a moved from object: 'accessToken'
// (lifetime.1) on MSVC version 14.40.33807+.
// Returning accessToken here directly causes the warning.
successfulParse = true;
break;
}

More context #5733 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Azure.IdentityEngSysThis issue is impacting the engineering system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions