Skip to content

Commit

Permalink
Add argument to static_assert() call to work with compilers that defa…
Browse files Browse the repository at this point in the history
…ult to c++14 or earlier.
  • Loading branch information
dyung committed Aug 12, 2023
1 parent fbbb8ad commit 182de29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clang/test/Sema/ms_predefined_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ constexpr bool equal(const T (&a)[N], const T (&b)[N]) {
return true;
}

#define ASSERT_EQ(X, Y) static_assert(equal(X, Y))
#define ASSERT_EQ_TY(X, Y) static_assert(is_same<decltype((X)[0]), decltype((Y)[0])>)
#define ASSERT_EQ(X, Y) static_assert(equal(X, Y), "")
#define ASSERT_EQ_TY(X, Y) static_assert(is_same<decltype((X)[0]), decltype((Y)[0])>, "")

#define _WIDE(s) L##s
#define WIDE(s) _WIDE(s)
Expand Down Expand Up @@ -158,7 +158,7 @@ constexpr size_t operator""_len(const char*, size_t len) {
}

void test_udliteral() {
static_assert(__FUNCTION__ ""_len == 14); // expected-warning{{expansion of predefined identifier '__FUNCTION__' to a string literal is a Microsoft extension}}
static_assert(__FUNCTION__ ""_len == 14, ""); // expected-warning{{expansion of predefined identifier '__FUNCTION__' to a string literal is a Microsoft extension}}
}

void test_static_assert() {
Expand Down

0 comments on commit 182de29

Please sign in to comment.