aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/ParseDecl.cpp2
-rw-r--r--test/SemaObjCXX/vla.mm12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 8aa69363be..62b10a316e 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -2588,7 +2588,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
"Haven't past the location of the identifier yet?");
// Don't parse attributes unless we have an identifier.
- if (D.getIdentifier() && getLang().CPlusPlus
+ if (D.getIdentifier() && getLang().CPlusPlus0x
&& isCXX0XAttributeSpecifier(true)) {
SourceLocation AttrEndLoc;
CXX0XAttributeList Attr = ParseCXX0XAttributes();
diff --git a/test/SemaObjCXX/vla.mm b/test/SemaObjCXX/vla.mm
new file mode 100644
index 0000000000..9c6fc54f81
--- /dev/null
+++ b/test/SemaObjCXX/vla.mm
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface Data
+- (unsigned)length;
+- (void)getData:(void*)buffer;
+@end
+
+void test(Data *d) {
+ char buffer[[d length]]; // expected-error{{variable length arrays are not permitted in C++}}
+ [d getData:buffer];
+}
+