aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c11-align-8.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/c11-align-8.c')
-rw-r--r--gcc/testsuite/gcc.dg/c11-align-8.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c11-align-8.c b/gcc/testsuite/gcc.dg/c11-align-8.c
new file mode 100644
index 0000000..a201674
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-align-8.c
@@ -0,0 +1,18 @@
+/* Test C11 alignment support. Test invalid use of alignment
+ specifiers in type names in cases not permitted by the resolution
+ of DR#444. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#include <stddef.h>
+
+void
+f (void)
+{
+ _Generic (1, int: 1, _Alignas (8) long: 2); /* { dg-error "expected" } */
+ sizeof (_Alignas (8) long); /* { dg-error "specified for type name" } */
+ _Alignof (_Alignas (8) long); /* { dg-error "specified for type name" } */
+ (_Alignas (8) long) 0; /* { dg-error "specified for type name" } */
+ _Atomic (_Alignas (8) long) x; /* { dg-error "expected" } */
+ _Alignas (_Alignas (8) long) long y; /* { dg-error "expected" } */
+}