[clang][NFC] Fix and simplify the test added in 8dcc7eecb7

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.
This commit is contained in:
Bruno Ricci 2020-06-09 21:11:09 +01:00
parent edd819c757
commit 856ba638d5
No known key found for this signature in database
GPG Key ID: D58C906B2F684D92
1 changed files with 2 additions and 13 deletions

View File

@ -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