Fix PR3386 by handling GCC's rules for alignof, which are substantially
different than those for sizeof. Reject alignof(bitfield) like gcc does.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62928 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c
index 73d73eb..5413757 100644
--- a/test/Sema/exprs.c
+++ b/test/Sema/exprs.c
@@ -45,3 +45,12 @@
__builtin_choose_expr (0, 42, i) = 10; // expected-warning {{extension used}}
return i;
}
+
+
+// PR3386
+struct f { int x : 4; float y[]; };
+int test9(struct f *P) {
+ return __alignof(P->x) + // expected-error {{invalid application of '__alignof' to bitfield}} expected-warning {{extension used}}
+ __alignof(P->y); // ok. expected-warning {{extension used}}
+}
+