]> granicus.if.org Git - clang/commitdiff
Silliness with commas, as reported at http://blog.regehr.org/archives/558 . As it...
authorEli Friedman <eli.friedman@gmail.com>
Wed, 13 Jul 2011 02:05:57 +0000 (02:05 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 13 Jul 2011 02:05:57 +0000 (02:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135026 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Expr.cpp
test/Sema/bitfield.c

index 5d8789fddabab75c774333d986e179ef2e849b1d..4611ae369969fe64dd38fd7805e51a4f32fce84b 100644 (file)
@@ -2529,10 +2529,14 @@ FieldDecl *Expr::getBitField() {
       if (Field->isBitField())
         return Field;
 
-  if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(E))
+  if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(E)) {
     if (BinOp->isAssignmentOp() && BinOp->getLHS())
       return BinOp->getLHS()->getBitField();
 
+    if (BinOp->getOpcode() == BO_Comma && BinOp->getRHS())
+      return BinOp->getRHS()->getBitField();
+  }
+
   return 0;
 }
 
index 49c1c7d443617d51d9f73c4309f67a99cb4203ee..a1ce894037f787b28b915a885137db07baed7a9f 100644 (file)
@@ -32,6 +32,7 @@ int y;
 
 struct {unsigned x : 2;} x2;
 __typeof__((x.x+=1)+1) y;
+__typeof__((0,x.x)+1) y;
 __typeof__(x.x<<1) y;
 int y;