Fix bitfield promotion in the presence of explicit casts, from Abrama Bagnara.

llvm-svn: 74830
This commit is contained in:
Douglas Gregor 2009-07-06 15:38:40 +00:00
parent e1cd1b5d2a
commit 19623dc075
2 changed files with 11 additions and 1 deletions

View File

@ -1458,7 +1458,7 @@ bool Expr::isNullPointerConstant(ASTContext &Ctx) const
} }
FieldDecl *Expr::getBitField() { FieldDecl *Expr::getBitField() {
Expr *E = this->IgnoreParenCasts(); Expr *E = this->IgnoreParens();
if (MemberExpr *MemRef = dyn_cast<MemberExpr>(E)) if (MemberExpr *MemRef = dyn_cast<MemberExpr>(E))
if (FieldDecl *Field = dyn_cast<FieldDecl>(MemRef->getMemberDecl())) if (FieldDecl *Field = dyn_cast<FieldDecl>(MemRef->getMemberDecl()))

View File

@ -0,0 +1,10 @@
// RUN: clang -fsyntax-only -Xclang -verify %s
struct {unsigned x : 2;} x;
__typeof__((x.x+=1)+1) y;
__typeof__(x.x<<1) y;
int y;
struct { int x : 8; } x1;
long long y1;
__typeof__(((long long)x1.x + 1)) y1;