blob: d05aef35793ead56113cbcfc2c8fec9456139c23 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm -o - %s | FileCheck %s
Daniel Dunbar894bbab2008-08-05 16:15:29 +00002// PR2001
3
4/* Test that the result of the assignment properly uses the value *in
5 the bitfield* as opposed to the RHS. */
6static int foo(int i) {
7 struct {
8 int f0 : 2;
9 } x;
10 return (x.f0 = i);
11}
12
13int bar() {
Anders Carlssona7601992009-11-22 18:56:40 +000014 // CHECK: ret i32 1
Daniel Dunbar894bbab2008-08-05 16:15:29 +000015 return foo(-5) == -1;
16}