summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/c99-variable-length-array.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-06 16:00:31 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-06 16:00:31 +0000
commit3999e15d93d461f9154120e3cc883693ec1a1118 (patch)
tree2ff55540f776151021d0e5a6941d39e8d6f07207 /clang/test/SemaCXX/c99-variable-length-array.cpp
parent5b389f495b152efe90496db352097710758d4e07 (diff)
downloadbcm5719-llvm-3999e15d93d461f9154120e3cc883693ec1a1118.tar.gz
bcm5719-llvm-3999e15d93d461f9154120e3cc883693ec1a1118.zip
Reject the allocation of variably-modified types in C++ 'new'
expressions. Fixes PR8209 in the narrowest way possible. I'm still considering whether I want to implement the extension that permits the use of VLA types in a 'new' expression. llvm-svn: 115790
Diffstat (limited to 'clang/test/SemaCXX/c99-variable-length-array.cpp')
-rw-r--r--clang/test/SemaCXX/c99-variable-length-array.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/c99-variable-length-array.cpp b/clang/test/SemaCXX/c99-variable-length-array.cpp
index 7dc912a0d5f..98df1dbfe81 100644
--- a/clang/test/SemaCXX/c99-variable-length-array.cpp
+++ b/clang/test/SemaCXX/c99-variable-length-array.cpp
@@ -114,3 +114,10 @@ namespace rdar8021385 {
};
B<A> a;
}
+
+namespace PR8209 {
+ void f(int n) {
+ typedef int vla_type[n]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ (void)new vla_type; // expected-error{{variably}}
+ }
+}
OpenPOWER on IntegriCloud