aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/alignof.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/alignof.cpp')
-rw-r--r--test/SemaCXX/alignof.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/SemaCXX/alignof.cpp b/test/SemaCXX/alignof.cpp
index a9de1ad07c9f..f0b89eef656d 100644
--- a/test/SemaCXX/alignof.cpp
+++ b/test/SemaCXX/alignof.cpp
@@ -9,7 +9,7 @@ struct S0 {
auto test2() -> char(&)[__alignof__(x)]; // expected-error {{invalid application of 'alignof' to a field of a class still being defined}}
};
-struct S1; // expected-note 5 {{forward declaration}}
+struct S1; // expected-note 6 {{forward declaration}}
extern S1 s1;
const int test3 = __alignof__(s1); // expected-error {{invalid application of 'alignof' to an incomplete type 'S1'}}
@@ -50,3 +50,15 @@ struct S4 {
static const int test1 = __alignof__(S0::x);
auto test2() -> char(&)[__alignof__(x)];
};
+
+// Regression test for asking for the alignment of a field within an invalid
+// record.
+struct S5 {
+ S1 s; // expected-error {{incomplete type}}
+ int x;
+};
+const int test8 = __alignof__(S5::x);
+
+long long int test14[2];
+
+static_assert(alignof(test14) == 8, "foo"); // expected-warning {{'alignof' applied to an expression is a GNU extension}}