aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaCXX/offsetof.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/offsetof.cpp')
-rw-r--r--clang/test/SemaCXX/offsetof.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/offsetof.cpp b/clang/test/SemaCXX/offsetof.cpp
index c4b288a..39ea380 100644
--- a/clang/test/SemaCXX/offsetof.cpp
+++ b/clang/test/SemaCXX/offsetof.cpp
@@ -83,3 +83,18 @@ struct Derived : virtual Base {
expected-error {{invalid application of 'offsetof' to a field of a virtual base}}
};
}
+
+int test_definition(void) {
+ return __builtin_offsetof(struct A // expected-error {{'A' cannot be defined in a type specifier}}
+ {
+ int a;
+ struct B // FIXME: error diagnostic message for nested definitions
+ // https://reviews.llvm.org/D133574
+ // fixme-error{{'A' cannot be defined in '__builtin_offsetof'}}
+ {
+ int c;
+ int d;
+ };
+ B x;
+ }, a);
+}