(This change only affects ObjC.)
<rdar://problem/
12857117>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170402
91177308-0d34-0410-b5e6-
96231b3b80d8
SourceLocation UnderlyingLoc = TI->getTypeLoc().getBeginLoc();
QualType T = TI->getType();
- if (T->isDependentType() || T->isIntegralType(Context))
+ if (T->isDependentType())
return false;
+ if (const BuiltinType *BT = T->getAs<BuiltinType>())
+ if (BT->isInteger())
+ return false;
+
Diag(UnderlyingLoc, diag::err_enum_invalid_underlying) << T;
return true;
}
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// expected-no-diagnostics
#if !__has_feature(objc_fixed_enum)
# error Enumerations with a fixed underlying type are not supported
// <rdar://problem/10760113>
typedef enum : long long { Bar = -1 } LongLongEnum;
int arr3[(long long)Bar == (long long)-1 ? 1 : -1];
+
+typedef enum : Integer { BaseElem } BaseEnum;
+typedef enum : BaseEnum { DerivedElem } DerivedEnum; // expected-error {{non-integral type 'BaseEnum' is an invalid underlying type}}