Handle new by passing the Declaration to the Action, not a processed type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60413 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 1ff1b2e..0a1a3ae 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -16,7 +16,7 @@
pi = new int('c');
const int *pci = new const int();
S *ps = new S(1, 2, 3.4);
- ps = new (pf) S(1, 2, 3.4);
+ ps = new (pf) (S)(1, 2, 3.4);
S *(*paps)[2] = new S*[*pi][2];
ps = new (S[3])(1, 2, 3.4);
typedef int ia4[4];
@@ -29,7 +29,7 @@
(void)new; // expected-error {{missing type specifier}}
(void)new 4; // expected-error {{missing type specifier}}
(void)new () int; // expected-error {{expected expression}}
- (void)new int[1.1]; // expected-error {{size of array has non-integer type}}
+ (void)new int[1.1]; // expected-error {{array size expression must have integral or enumerated type, not 'double'}}
(void)new int[1][i]; // expected-error {{only the first dimension}}
(void)new (int[1][i]); // expected-error {{only the first dimension}}
(void)new int(*(S*)0); // expected-error {{incompatible type initializing}}
@@ -38,6 +38,9 @@
(void)new S(1, 1); // expected-error {{call to constructor of 'S' is ambiguous}}
(void)new const int; // expected-error {{must provide an initializer}}
(void)new float*(ip); // expected-error {{incompatible type initializing 'int *', expected 'float *'}}
+ // Undefined, but clang should reject it directly.
+ (void)new int[-1]; // expected-error {{array size is negative}}
+ (void)new int[*(S*)0]; // expected-error {{array size expression must have integral or enumerated type, not 'struct S'}}
// Some lacking cases due to lack of sema support.
}