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

MatchAndExplainImpl fails to compile with VC++ 2013 /analyze #172

Open
GoogleCodeExporter opened this issue May 13, 2015 · 1 comment
Open

Comments

@GoogleCodeExporter
Copy link

When building all of Chrome with /analyze (static analysis) a build failure 
happened starting when this change was submitted:

https://codereview.chromium.org/777033004

This happened because this triggered problematic use of MatchAndExplainImpl 
with the compiler complaining:

error C2248: 'scoped_ptr<std::string,base::DefaultDeleter<T>>::scoped_ptr' : 
cannot access private member declared in class 
'scoped_ptr<std::string,base::DefaultDeleter<T>>'

This is presumably a compiler bug, but the workaround is so easy that it seems 
worth adding. This line, from gmock-matchers.h:

RefToConstProperty result = (obj.*property_)();

needs to be replaced with this:

RefToConstProperty result = std::move((obj.*property_)());

This makes the use of the move constructor with scoped_ptr explicit instead of 
implicit, and should have no effect on other code.

Here is the build failure:

http://build.chromium.org/p/chromium.fyi/builders/Chromium%20Windows%20Analyze/b
uilds/61/steps/compile/logs/stdio

Original issue reported on code.google.com by brucedaw...@chromium.org on 28 Jan 2015 at 11:18

@GoogleCodeExporter
Copy link
Author

This is currently the only issue preventing all of Chrome from building with 
/analyze.

Original comment by brucedaw...@chromium.org on 29 Jan 2015 at 12:04

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

1 participant