Skip to content

Commit

Permalink
Use C++11 compatible version of static_assert; before
Browse files Browse the repository at this point in the history
C++17 the second message parameter to static_assert was
not optional.

Some particularly old compiler (gcc-5) was having trouble
https://travis-ci.org/github/google/verible/jobs/669946250#L1428

PiperOrigin-RevId: 304449377
  • Loading branch information
hzeller committed Apr 2, 2020
1 parent 5d7fe52 commit 5e1e006
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions common/util/forward_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ TEST(ForwardReferenceElseConstructTest, ForwardReferenceConst) {
TEST(ForwardReferenceElseConstructTest, Construct) {
const TestClassA a;
const auto& ref = ForwardReferenceElseConstruct<TestClassB>()(a);
static_assert(!std::is_same<decltype(ref), TestClassA>::value);
static_assert(!std::is_same<decltype(ref), TestClassA>::value,
"!std::is_same<decltype(ref), TestClassA>::value");
}

TEST(ForwardReferenceElseConstructTest, ForwardStringView) {
Expand All @@ -58,7 +59,8 @@ TEST(ForwardReferenceElseConstructTest, ForwardStringView) {
TEST(ForwardReferenceElseConstructTest, ConstructString) {
const absl::string_view a("hello");
const auto& ref = ForwardReferenceElseConstruct<std::string>()(a);
static_assert(!std::is_same<decltype(ref), absl::string_view>::value);
static_assert(!std::is_same<decltype(ref), absl::string_view>::value,
"!std::is_same<decltype(ref), absl::string_view>::value");
}

TEST(ForwardReferenceElseConstructTest, ForwardString) {
Expand All @@ -70,7 +72,8 @@ TEST(ForwardReferenceElseConstructTest, ForwardString) {
TEST(ForwardReferenceElseConstructTest, ConstructStringView) {
const std::string a("hello");
const auto& ref = ForwardReferenceElseConstruct<absl::string_view>()(a);
static_assert(!std::is_same<decltype(ref), std::string>::value);
static_assert(!std::is_same<decltype(ref), std::string>::value,
"!std::is_same<decltype(ref), std::string>::value");
}

} // namespace
Expand Down

0 comments on commit 5e1e006

Please sign in to comment.