Diagnose that property name cannot be a bitfield


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62432 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def
index fd5215e..018aa54 100644
--- a/include/clang/Basic/DiagnosticKinds.def
+++ b/include/clang/Basic/DiagnosticKinds.def
@@ -446,6 +446,8 @@
      "setter/getter expects '=' followed by name")
 DIAG(err_objc_property_requires_field_name, ERROR,
      "property requires fields to be named")
+DIAG(err_objc_property_bitfield, ERROR,
+     "property name cannot be a bitfield")
 DIAG(err_objc_expected_property_attr, ERROR,
      "unknown property attribute %0")
 DIAG(err_objc_propertoes_require_objc2, ERROR,
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index f406eab..96673f0 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -325,6 +325,11 @@
             << FD.D.getSourceRange();
           continue;
         }
+        if (FD.BitfieldSize) {
+          Diag(AtLoc, diag::err_objc_property_bitfield)
+            << FD.D.getSourceRange();
+          continue;
+        }
         
         // Install the property declarator into interfaceDecl.
         IdentifierInfo *SelName =
diff --git a/test/Parser/objc-property-syntax.m b/test/Parser/objc-property-syntax.m
new file mode 100644
index 0000000..1a8fd11
--- /dev/null
+++ b/test/Parser/objc-property-syntax.m
@@ -0,0 +1,12 @@
+// RUN: clang -fsyntax-only -verify %s
+
+@interface MyClass {
+
+};
+@property unsigned char bufferedUTF8Bytes[4];  // expected-error {{property cannot have array or function type}}
+@property unsigned char bufferedUTFBytes:1;    // expected-error {{property name cannot be a bitfield}}
+@end
+
+@implementation MyClass
+@end
+