[cfe-commits] r143724 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaObjC/fixed-enum.m
Fariborz Jahanian
fjahanian at apple.com
Fri Nov 4 11:51:24 PDT 2011
Author: fjahanian
Date: Fri Nov 4 13:51:24 2011
New Revision: 143724
URL: http://llvm.org/viewvc/llvm-project?rev=143724&view=rev
Log:
objc: fixed enum type is supported in objc mode.
Fixes a bug where enumerator type is not this
fixed type. // rdar://10381507
Added:
cfe/trunk/test/SemaObjC/fixed-enum.m
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=143724&r1=143723&r2=143724&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Nov 4 13:51:24 2011
@@ -9812,6 +9812,7 @@
unsigned NewWidth;
bool NewSign;
if (!getLangOptions().CPlusPlus &&
+ !Enum->isFixed() &&
isRepresentableIntegerValue(Context, InitVal, Context.IntTy)) {
NewTy = Context.IntTy;
NewWidth = IntWidth;
Added: cfe/trunk/test/SemaObjC/fixed-enum.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/fixed-enum.m?rev=143724&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/fixed-enum.m (added)
+++ cfe/trunk/test/SemaObjC/fixed-enum.m Fri Nov 4 13:51:24 2011
@@ -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];
More information about the cfe-commits
mailing list