-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
VS2015/2017 build fix and enable C++11 features (attempt number three) #1218
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
EXPECT_THAT(t, (Args<0, 1>(Lt()))); | ||
EXPECT_THAT(t, (Args<1, 2>(Lt()))); | ||
EXPECT_THAT(t, Not(Args<0, 2>(Gt()))); | ||
} | ||
|
||
TEST(ArgsTest, AcceptsRepeatedTemplateArgs) { | ||
const tuple<short, int, long> t(4, 5, 6L); // NOLINT | ||
const tuple<short, int, long> t(static_cast<short>(4), 5, 6L); // NOLINT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? Please explain static_cast and exactly why its needed here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
EXPECT_THAT(t, (Args<0, 0>(Eq()))); | ||
EXPECT_THAT(t, Not(Args<1, 1>(Ne()))); | ||
} | ||
|
||
TEST(ArgsTest, AcceptsDecreasingTemplateArgs) { | ||
const tuple<short, int, long> t(4, 5, 6L); // NOLINT | ||
const tuple<short, int, long> t(static_cast<short>(4), 5, 6L); // NOLINT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
EXPECT_THAT(t, (Args<2, 0>(Gt()))); | ||
EXPECT_THAT(t, Not(Args<2, 1>(Lt()))); | ||
} | ||
|
@@ -159,7 +159,7 @@ TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) { | |
} | ||
|
||
TEST(ArgsTest, CanBeNested) { | ||
const tuple<short, int, long, int> t(4, 5, 6L, 6); // NOLINT | ||
const tuple<short, int, long, int> t(static_cast<short>(4), 5, 6L, 6); // NOLINT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq())))); | ||
EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt())))); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,11 @@ | |
# include <forward_list> // NOLINT | ||
#endif | ||
|
||
// Disable MSVC2015 warning for std::pair: "decorated name length exceeded, name was truncated". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it really only apply to 2015? What happens in 2017? I would want to see test results for both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these changes fix compiler warning: I'll check that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VS 2015 produce this error:
VS2017 compile gtest without warnings (maybe because of variadic templates) |
||
#if defined(_MSC_VER) && (_MSC_VER == 1900) | ||
# pragma warning(disable:4503) | ||
#endif | ||
|
||
namespace testing { | ||
|
||
namespace internal { | ||
|
@@ -3931,8 +3936,11 @@ TEST(ResultOfTest, WorksForFunctionReferences) { | |
|
||
// Tests that ResultOf(f, ...) compiles and works as expected when f is a | ||
// function object. | ||
struct Functor : public ::std::unary_function<int, std::string> { | ||
result_type operator()(argument_type input) const { | ||
struct Functor { | ||
typedef std::string result_type; | ||
typedef int argument_type; | ||
|
||
std::string operator()(int input) const { | ||
return IntToStringFunction(input); | ||
} | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Please explain static_cast and exactly why its needed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KindDragon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line produces warning
tuple(165): warning C4244: 'initializing': conversion from 'int' to 'short', possible loss of data
and because of-WX
compiler produce errors for warningsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same bellow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same change was proposed in #1136