summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.dg/c1x-align-1.c
blob: 9fe5757bed0a7ff9abad0a8771c248d9a3a1857c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* Test C1X alignment support.  Test valid code.  */
/* { dg-do compile } */
/* { dg-options "-std=c1x -pedantic-errors" } */

#include <stddef.h>

_Alignas (_Alignof (max_align_t)) char c;
extern _Alignas (max_align_t) char c;
extern char c;

extern _Alignas (max_align_t) short s;
_Alignas (max_align_t) short s;

_Alignas (int) int i;
extern int i;

_Alignas (max_align_t) long l;

_Alignas (max_align_t) long long ll;

_Alignas (max_align_t) float f;

_Alignas (max_align_t) double d;

_Alignas (max_align_t) _Complex long double cld;

_Alignas (0) _Alignas (int) _Alignas (char) char ca[10];

_Alignas ((int) _Alignof (max_align_t) + 0) int x;

enum e { E = _Alignof (max_align_t) };
_Alignas (E) int y;

void
func (void)
{
  _Alignas (max_align_t) long long auto_ll;
}

/* Valid, but useless.  */
_Alignas (0) struct s; /* { dg-warning "useless" } */
OpenPOWER on IntegriCloud