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

Prevent implicit down cast. This may give compiler warnings. #1136

Closed
wants to merge 5 commits into from

Conversation

jokri
Copy link

@jokri jokri commented Jul 1, 2017

This is a fix for issue #1133.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@jokri
Copy link
Author

jokri commented Jul 1, 2017

I added my alternate/commit E-mail address to my google account.

@googlebot
Copy link

CLAs look good, thanks!

@jokri jokri closed this Jul 1, 2017
@jokri jokri reopened this Jul 1, 2017
@@ -120,21 +120,21 @@ TEST(ArgsTest, AcceptsOneTemplateArg) {
}

TEST(ArgsTest, AcceptsTwoTemplateArgs) {
const tuple<short, int, long> t(4, 5, 6L); // NOLINT
const tuple<short, int, long> t(static_cast<short>(4), 5, 6L); // NOLINT

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "NOLINT" still required?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not. How can I tell? Is lint run during the "check" process?

@gennadiycivil
Copy link
Contributor

Could you please provide clear test evidence before and after

@jokri
Copy link
Author

jokri commented Aug 15, 2017

Is this the test evidence you are looking/asking for?

...
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...
    <PlatformToolset>v141</PlatformToolset>
...
      <WarningLevel>Level4</WarningLevel>
      <TreatWarningAsError>true</TreatWarningAsError>
...

before:

1>------ Rebuild All started: Project: gmock, Configuration: Debug Win32 ------
1>gmock-all.cc
1>gtest-all.cc
1>gmock.vcxproj -> H:\contribute\googletest-jokri\googlemock\msvc\2017\Debug\gmock.lib
2>------ Rebuild All started: Project: gmock_main, Configuration: Debug Win32 ------
2>gmock_main.cc
2>gmock_main.vcxproj -> H:\contribute\googletest-jokri\googlemock\msvc\2017\Debug\gmock_main.lib
3>------ Rebuild All started: Project: gmock_test, Configuration: Debug Win32 ------
3>gmock_all_test.cc
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\tuple(165): error C2220: warning treated as error - no 'object' file generated
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\tuple(292): note: see reference to function template instantiation 'std::_Tuple_val<_This>::_Tuple_val<_Ty>(_Other &&)' being compiled
3>        with
3>        [
3>            _This=short,
3>            _Ty=int,
3>            _Other=int
3>        ]
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\tuple(291): note: see reference to function template instantiation 'std::_Tuple_val<_This>::_Tuple_val<_Ty>(_Other &&)' being compiled
3>        with
3>        [
3>            _This=short,
3>            _Ty=int,
3>            _Other=int
3>        ]
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\tuple(422): note: see reference to function template instantiation 'std::tuple<short,int,long>::tuple<std::_Exact_args_t,_Ty,_Ty,long,0>(_Tag,_This2 &&,_Ty &&,long &&)' being compiled
3>        with
3>        [
3>            _Ty=int,
3>            _Tag=std::_Exact_args_t,
3>            _This2=int
3>        ]
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\tuple(421): note: see reference to function template instantiation 'std::tuple<short,int,long>::tuple<std::_Exact_args_t,_Ty,_Ty,long,0>(_Tag,_This2 &&,_Ty &&,long &&)' being compiled
3>        with
3>        [
3>            _Ty=int,
3>            _Tag=std::_Exact_args_t,
3>            _This2=int
3>        ]
3>H:\contribute\googletest-jokri\googlemock\test/gmock-generated-matchers_test.cc(123): note: see reference to function template instantiation 'std::tuple<short,int,long>::tuple<int,int,long,0>(_This2 &&,int &&,long &&)' being compiled
3>        with
3>        [
3>            _This2=int
3>        ]
3>H:\contribute\googletest-jokri\googlemock\test/gmock-generated-matchers_test.cc(123): note: see reference to function template instantiation 'std::tuple<short,int,long>::tuple<int,int,long,0>(_This2 &&,int &&,long &&)' being compiled
3>        with
3>        [
3>            _This2=int
3>        ]
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\tuple(165): warning C4244: 'initializing': conversion from 'int' to 'short', possible loss of data
3>Done building project "gmock_test.vcxproj" -- FAILED.
========== Rebuild All: 2 succeeded, 1 failed, 0 skipped ==========

after:

1>------ Rebuild All started: Project: gmock, Configuration: Debug Win32 ------
1>gmock-all.cc
1>gtest-all.cc
1>gmock.vcxproj -> H:\contribute\googletest-jokri\googlemock\msvc\2017\Debug\gmock.lib
2>------ Rebuild All started: Project: gmock_main, Configuration: Debug Win32 ------
2>gmock_main.cc
2>gmock_main.vcxproj -> H:\contribute\googletest-jokri\googlemock\msvc\2017\Debug\gmock_main.lib
3>------ Rebuild All started: Project: gmock_test, Configuration: Debug Win32 ------
3>gmock_all_test.cc
3>gmock_test.vcxproj -> H:\contribute\googletest-jokri\googlemock\msvc\2017\Debug\gmock_test.exe
3>gmock_test.vcxproj -> H:\contribute\googletest-jokri\googlemock\msvc\2017\Debug\gmock_test.pdb (Full PDB)
========== Rebuild All: 3 succeeded, 0 failed, 0 skipped ==========

@KindDragon
Copy link
Contributor

Can be closed. PR #1218 fixed this

@jokri
Copy link
Author

jokri commented Oct 25, 2017

Closing this PR, PR #1218 fixed this.

@jokri jokri closed this Oct 25, 2017
@jokri jokri deleted the issue1133 branch October 25, 2017 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants