summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-11-04 18:51:24 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-11-04 18:51:24 +0000
commit37c64179491376bb0dff54461d51f4ae54525894 (patch)
tree25b68d412f5ccf4a23faf8f098720b3cbb865f85
parent5f689e7b3a263519c61e3be1ec6341c89b0f97a5 (diff)
downloadbcm5719-llvm-37c64179491376bb0dff54461d51f4ae54525894.tar.gz
bcm5719-llvm-37c64179491376bb0dff54461d51f4ae54525894.zip
objc: fixed enum type is supported in objc mode.
Fixes a bug where enumerator type is not this fixed type. // rdar://10381507 llvm-svn: 143724
-rw-r--r--clang/lib/Sema/SemaDecl.cpp1
-rw-r--r--clang/test/SemaObjC/fixed-enum.m7
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 806608cf439..05f48707aa2 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9812,6 +9812,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
unsigned NewWidth;
bool NewSign;
if (!getLangOptions().CPlusPlus &&
+ !Enum->isFixed() &&
isRepresentableIntegerValue(Context, InitVal, Context.IntTy)) {
NewTy = Context.IntTy;
NewWidth = IntWidth;
diff --git a/clang/test/SemaObjC/fixed-enum.m b/clang/test/SemaObjC/fixed-enum.m
new file mode 100644
index 00000000000..a057dc0d374
--- /dev/null
+++ b/clang/test/SemaObjC/fixed-enum.m
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://10381507
+
+typedef enum : long { Foo } IntegerEnum;
+int arr[(sizeof(typeof(Foo)) == sizeof(typeof(IntegerEnum))) - 1];
+int arr1[(sizeof(typeof(Foo)) == sizeof(typeof(long))) - 1];
+int arr2[(sizeof(typeof(IntegerEnum)) == sizeof(typeof(long))) - 1];
OpenPOWER on IntegriCloud