Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApprovalTests.v.8.3.0.hpp(2385): warning C26444: Avoid unnamed objects with custom construction and destruction (es.84). #100

Open
alastairUK opened this issue Feb 14, 2020 · 5 comments

Comments

@alastairUK
Copy link
Contributor

Looking at the results of Visual Studio code analysis on my project using the default Microsoft Native Recommended Rules with the latest ApprovalTests header I see this warning:

ApprovalTests.v.8.3.0.hpp(2385): warning C26444: Avoid unnamed objects with custom construction and destruction (es.84).

        explicit CIBuildOnlyReporter(std::shared_ptr<Reporter> reporter = std::make_shared<QuietReporter>())
            : m_reporter(reporter)
        {
        }

image

@claremacrae
Copy link
Collaborator

Thanks Alastair. I've read the help...
https://docs.microsoft.com/en-us/visualstudio/code-quality/c26444?view=vs-2019

I'm not spotting what the unnamed - discarded - thing is...
Can you see it?

@claremacrae
Copy link
Collaborator

I also can't load the screenshot image - I get:

Secure Connection Failed

An error occurred during a connection to user-images.githubusercontent.com. Cannot communicate securely with peer: no common encryption algorithm(s).

Error code: SSL_ERROR_NO_CYPHER_OVERLAP

I've been seeing this more and more in GitHub issues recently - did the image contain anything that wasn't in the text body of the report?

@alastairUK
Copy link
Contributor Author

It was just a screenshot of where VS is putting the green squiggles. Basically it's under this:

explicit CIBuildOnlyReporter(std::shared_ptr<Reporter> reporter =

I am not sure I understand the issue it's flagging up but as it's the only code analysis warning I am seeing in my project i thought I would flag it up before disabling it with a pragma in my codebase.

@claremacrae
Copy link
Collaborator

I see the warning in VS2019 - and changing the code like this makes it go away, i.e. passing the argument as a const reference...

     public:
-        explicit CIBuildOnlyReporter(std::shared_ptr<Reporter> reporter =
+        explicit CIBuildOnlyReporter(const std::shared_ptr<Reporter>& reporter =
                                          std::make_shared<QuietReporter>())
             : m_reporter(reporter)
         {

I assume/speculate that it's something to do with the internals of std::shared_ptr...

@isidore
Copy link
Member

isidore commented Aug 23, 2021

We are placing this on hold until we see it on a windows machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants