forked from OSchip/llvm-project
Implement comparison of C++0x scoped enumeration types. Fixes PR9333.
llvm-svn: 126752
This commit is contained in:
parent
9760a666d6
commit
48e6bbffa1
|
@ -7024,6 +7024,12 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
|
|||
ImpCastExprToType(rex, T, CK_BitCast);
|
||||
return ResultTy;
|
||||
}
|
||||
|
||||
// Handle scoped enumeration types specifically, since they don't promote
|
||||
// to integers.
|
||||
if (lex->getType()->isEnumeralType() &&
|
||||
Context.hasSameUnqualifiedType(lex->getType(), rex->getType()))
|
||||
return ResultTy;
|
||||
}
|
||||
|
||||
// Handle block pointer types.
|
||||
|
@ -7123,6 +7129,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
|
|||
ImpCastExprToType(lex, rType, CK_NullToPointer);
|
||||
return ResultTy;
|
||||
}
|
||||
|
||||
return InvalidOperands(Loc, lex, rex);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,3 +103,9 @@ enum : long {
|
|||
|
||||
enum : long x; // expected-error{{unnamed enumeration must be a definition}} \
|
||||
// expected-warning{{declaration does not declare anything}}
|
||||
|
||||
void PR9333() {
|
||||
enum class scoped_enum { yes, no, maybe };
|
||||
scoped_enum e = scoped_enum::yes;
|
||||
if (e == scoped_enum::no) { }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue