diff options
author | dim <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
commit | c86b984ea8ecb3e944dc3de48539f4c1f65851ea (patch) | |
tree | 3eb853da77d46cc77c4b017525a422f9ddb1385b /test/Sema/bitfield.c | |
parent | c696171ff15f0ee60dea4abfd99a135473c95656 (diff) | |
download | FreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.zip FreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.tar.gz |
Vendor import of clang RELEASE_360/rc1 tag r226102 (effectively, 3.6.0 RC1):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc1@226102
Diffstat (limited to 'test/Sema/bitfield.c')
-rw-r--r-- | test/Sema/bitfield.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/Sema/bitfield.c b/test/Sema/bitfield.c index ab05a77..fb72213 100644 --- a/test/Sema/bitfield.c +++ b/test/Sema/bitfield.c @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify +// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c11 -Wno-unused-value + enum e0; // expected-note{{forward declaration of 'enum e0'}} struct a { @@ -54,3 +55,22 @@ void test4(struct Test4 *t) { (void) sizeof(t->var ? t->bitX : t->bitY); // not a bitfield designator in C (void) sizeof(t->var ? t->bitX : t->bitX); // not a bitfield designator in C } + +typedef unsigned Unsigned; +typedef signed Signed; + +struct Test5 { unsigned n : 2; } t5; +typedef __typeof__(t5.n) Unsigned; // Bitfield is unsigned +typedef __typeof__(+t5.n) Signed; // ... but promotes to signed. + +typedef __typeof__(t5.n + 0) Signed; // Arithmetic promotes. + +typedef __typeof__(+(t5.n = 0)) Signed; // FIXME: Assignment should not; the result +typedef __typeof__(+(t5.n += 0)) Signed; // is a non-bit-field lvalue of type unsigned. +typedef __typeof__(+(t5.n *= 0)) Signed; + +typedef __typeof__(+(++t5.n)) Signed; // FIXME: Increment is equivalent to compound-assignment. +typedef __typeof__(+(--t5.n)) Signed; // This should not promote to signed. + +typedef __typeof__(+(t5.n++)) Unsigned; // Post-increment is underspecified, but seems to +typedef __typeof__(+(t5.n--)) Unsigned; // also act like compound-assignment. |