Azure / azure-sdk-for-cpp

This repository is for active development of the Azure SDK for C++. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-cpp.
MIT License
181 stars 126 forks source link

Fix warnings C26800: Use of a moved from object, in certificate_client_models.hpp #6227

Open ahsonkhan opened 1 week ago

ahsonkhan commented 1 week ago

https://learn.microsoft.com/en-us/cpp/code-quality/c26800?view=msvc-170

Severity    Code    Description Project File    Line    Suppression State   Details
Warning C26800  Use of a moved from object: ''(certificateProperties->Azure::Security::KeyVault::Certificates::CertificatePropertiesPagedResponse::Items)'' (lifetime.1).   azure-sdk   C:\GitHub\Fork\azure-sdk-for-cpp\sdk\keyvault\azure-security-keyvault-certificates\inc\azure\keyvault\certificates\certificate_client_models.hpp    1330        
Warning C26800  Use of a moved from object: ''(issuerProperties->Azure::Security::KeyVault::Certificates::IssuerPropertiesPagedResponse::Items)'' (lifetime.1). azure-sdk   C:\GitHub\Fork\azure-sdk-for-cpp\sdk\keyvault\azure-security-keyvault-certificates\inc\azure\keyvault\certificates\certificate_client_models.hpp    1368        
Warning C26800  Use of a moved from object: ''(deletedProperties->Azure::Security::KeyVault::Certificates::DeletedCertificatesPagedResponse::Items)'' (lifetime.1). azure-sdk   C:\GitHub\Fork\azure-sdk-for-cpp\sdk\keyvault\azure-security-keyvault-certificates\inc\azure\keyvault\certificates\certificate_client_models.hpp    1406        

For example, note that Items(std::move(certificateProperties.Items)) is giving a warning because certificateProperties has already moved, in PagedResponse(std::move(certificateProperties)). https://github.com/Azure/azure-sdk-for-cpp/blob/384552adff3d6cdea46cdf8a345120b183bdcc1e/sdk/keyvault/azure-security-keyvault-certificates/inc/azure/keyvault/certificates/certificate_client_models.hpp#L1324-L1331

https://github.com/Azure/azure-sdk-for-cpp/blob/384552adff3d6cdea46cdf8a345120b183bdcc1e/sdk/keyvault/azure-security-keyvault-certificates/inc/azure/keyvault/certificates/certificate_client_models.hpp#L1363-L1369

https://github.com/Azure/azure-sdk-for-cpp/blob/384552adff3d6cdea46cdf8a345120b183bdcc1e/sdk/keyvault/azure-security-keyvault-certificates/inc/azure/keyvault/certificates/certificate_client_models.hpp#L1401-L1407