summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-12-22 17:13:37 +0000
committerDouglas Gregor <dgregor@apple.com>2009-12-22 17:13:37 +0000
commit2e9c795df03b73f020366125157bad9e17672083 (patch)
tree8ed0b79e81de58ce192a3c28b6230eaee49574b3 /clang/test
parentbbeb5c391ca99b71ccb39df0aa7bc3197e66e0a6 (diff)
downloadbcm5719-llvm-2e9c795df03b73f020366125157bad9e17672083.tar.gz
bcm5719-llvm-2e9c795df03b73f020366125157bad9e17672083.zip
When transforming a C++ "new" expression that was not explicitly given
a size, check whether the transformed type is itself an array type. If so, take the major array bound as the size to allocate. Fixes PR5833. llvm-svn: 91907
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaTemplate/instantiate-expr-4.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-expr-4.cpp b/clang/test/SemaTemplate/instantiate-expr-4.cpp
index e0042de50e6..99bbbf7a162 100644
--- a/clang/test/SemaTemplate/instantiate-expr-4.cpp
+++ b/clang/test/SemaTemplate/instantiate-expr-4.cpp
@@ -84,6 +84,20 @@ template struct New2<X, int, float>;
template struct New2<X, int, int*>; // expected-note{{instantiation}}
// FIXME: template struct New2<int, int, float>;
+// PR5833
+struct New3 {
+ New3();
+
+ void *operator new[](__SIZE_TYPE__) __attribute__((unavailable)); // expected-note{{explicitly made unavailable}}
+};
+
+template<class C>
+void* object_creator() {
+ return new C(); // expected-error{{call to unavailable function 'operator new[]'}}
+}
+
+template void *object_creator<New3[4]>(); // expected-note{{instantiation}}
+
template<typename T>
struct Delete0 {
void f(T t) {
OpenPOWER on IntegriCloud