aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decl.c8
-rw-r--r--tests/alignas.c1
-rw-r--r--tests/alignas.qbe1
3 files changed, 6 insertions, 4 deletions
diff --git a/decl.c b/decl.c
index 3e07e9d..99834e6 100644
--- a/decl.c
+++ b/decl.c
@@ -228,7 +228,7 @@ tagspec(struct scope *s)
static struct type *
declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)
{
- struct type *t;
+ struct type *t, *other;
struct decl *d;
enum typespec ts = SPECNONE;
enum typequal tq = QUALNONE;
@@ -341,9 +341,9 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)
error(&tok.loc, "alignment specifier not allowed in this declaration");
next();
expect(TLPAREN, "after '_Alignas'");
- t = typename(s);
- if (t) {
- *align = t->align;
+ other = typename(s);
+ if (other) {
+ *align = other->align;
} else {
i = intconstexpr(s, false);
if (!i || i & (i - 1) || i > 16)
diff --git a/tests/alignas.c b/tests/alignas.c
new file mode 100644
index 0000000..394045d
--- /dev/null
+++ b/tests/alignas.c
@@ -0,0 +1 @@
+_Alignas(int) char x[4];
diff --git a/tests/alignas.qbe b/tests/alignas.qbe
new file mode 100644
index 0000000..7cf0e40
--- /dev/null
+++ b/tests/alignas.qbe
@@ -0,0 +1 @@
+export data $x = align 4 { z 4 }