[clang] 182de29 - Add argument to static_assert() call to work with compilers that default to c++14 or earlier.

Douglas Yung via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 11 17:55:14 PDT 2023


Author: Douglas Yung
Date: 2023-08-11T17:54:58-07:00
New Revision: 182de296f7bac49c655304d5c9f6b0edadf48302

URL: https://github.com/llvm/llvm-project/commit/182de296f7bac49c655304d5c9f6b0edadf48302
DIFF: https://github.com/llvm/llvm-project/commit/182de296f7bac49c655304d5c9f6b0edadf48302.diff

LOG: Add argument to static_assert() call to work with compilers that default to c++14 or earlier.

Added: 
    

Modified: 
    clang/test/Sema/ms_predefined_expr.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Sema/ms_predefined_expr.cpp b/clang/test/Sema/ms_predefined_expr.cpp
index 27025e0de7ff54..5919ee964ccab9 100644
--- a/clang/test/Sema/ms_predefined_expr.cpp
+++ b/clang/test/Sema/ms_predefined_expr.cpp
@@ -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)
@@ -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() {


        


More information about the cfe-commits mailing list