type. Fixes PR8089 in a slightly different way than had been suggested.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113711
91177308-0d34-0410-b5e6-
96231b3b80d8
// We pre-calculate the promotion type for enum types.
if (const EnumType *FromEnumType = FromType->getAs<EnumType>())
- if (ToType->isIntegerType())
+ if (ToType->isIntegerType() &&
+ !RequireCompleteType(From->getLocStart(), FromType, PDiag()))
return Context.hasSameUnqualifiedType(ToType,
FromEnumType->getDecl()->getPromotionType());
enum PR7921E {
PR7921V = (PR7921E)(123) // expected-error {{expression is not an integer constant expression}}
};
+
+void PR8089() {
+ enum E; // expected-error{{ISO C++ forbids forward references to 'enum' types}}
+ int a = (E)3; // expected-error{{cannot initialize a variable of type 'int' with an rvalue of type 'E'}}
+}