[clang] 856ba63 - [clang][NFC] Fix and simplify the test added in 8dcc7eecb75b39d723fd6fee566369bf67e43fdf
Bruno Ricci via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 9 13:18:13 PDT 2020
Author: Bruno Ricci
Date: 2020-06-09T21:17:19+01:00
New Revision: 856ba638d57ead6df85a4ff39531282c6c110232
URL: https://github.com/llvm/llvm-project/commit/856ba638d57ead6df85a4ff39531282c6c110232
DIFF: https://github.com/llvm/llvm-project/commit/856ba638d57ead6df85a4ff39531282c6c110232.diff
LOG: [clang][NFC] Fix and simplify the test added in 8dcc7eecb75b39d723fd6fee566369bf67e43fdf
We only have to create a TypeTraitExpr node with 16 bits worth of
arguments to detect an overflow with the assertion added in the
constructor of TypeTraitExpr. Moreover the static_assert in
original test is pointless since __is_constructible only check
that the corresponding expression is well-formed.
Added:
Modified:
clang/test/SemaCXX/type-traits.cpp
Removed:
################################################################################
diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp
index 59ae31130528..5adb1f99c27f 100644
--- a/clang/test/SemaCXX/type-traits.cpp
+++ b/clang/test/SemaCXX/type-traits.cpp
@@ -2831,13 +2831,7 @@ namespace ConstClass {
}
namespace type_trait_expr_numargs_overflow {
- // Make sure that TypeTraitExpr can store 16 bits worth of arguments.
- struct S {
- template <typename... Ts> S(Ts... ts) {
- static_assert(sizeof...(ts) == 32768+1, "");
- }
-};
-
+// Make sure that TypeTraitExpr can store 16 bits worth of arguments.
#define T4(X) X,X,X,X
#define T16(X) T4(X),T4(X),T4(X),T4(X)
#define T64(X) T16(X),T16(X),T16(X),T16(X)
@@ -2846,11 +2840,7 @@ namespace type_trait_expr_numargs_overflow {
#define T4096(X) T1024(X),T1024(X),T1024(X),T1024(X)
#define T16384(X) T4096(X),T4096(X),T4096(X),T4096(X)
#define T32768(X) T16384(X),T16384(X)
-
-void test() {
- static_assert(__is_constructible(S, T32768(int), float), "");
-}
-
+void test() { (void) __is_constructible(int, T32768(int)); }
#undef T4
#undef T16
#undef T64
@@ -2859,5 +2849,4 @@ void test() {
#undef T4096
#undef T16384
#undef T32768
-
} // namespace type_trait_expr_numargs_overflow
More information about the cfe-commits
mailing list