1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2 // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -Wno-objc-root-class %s
4 #if __has_feature(objc_c_static_assert)
7 #if !__has_extension(objc_c_static_assert)
11 #if __cplusplus >= 201103L
13 #if !__has_feature(objc_cxx_static_assert)
22 _Static_assert(1, "");
24 static_assert(0, ""); // expected-error {{static assertion failed}}
25 _Static_assert(0, ""); // expected-error {{static assertion failed}}
27 static_assert(a, ""); // expected-error {{static assertion expression is not an integral constant expression}}
28 static_assert(sizeof(a) == 4, "");
29 static_assert(sizeof(a) == 3, ""); // expected-error {{static assertion failed}} \
30 // expected-note {{evaluates to '4 == 3'}}
34 _Static_assert(1, "");
42 _Static_assert(1, "");
43 static_assert(sizeof(b) == 4, "");
44 static_assert(sizeof(b) == 3, ""); // expected-error {{static assertion failed}} \
45 // expected-note {{evaluates to '4 == 3'}}
60 static_assert(sizeof(b) == 4, "");
61 static_assert(sizeof(b) == 3, ""); // expected-error {{static assertion failed}} \
62 // expected-note {{evaluates to '4 == 3'}}
68 #if __has_feature(objc_cxx_static_assert)
75 static_assert(1, ""); // expected-error {{type name requires a specifier or qualifier}} expected-error{{expected parameter declarator}} expected-error {{expected ')'}} expected-note {{to match this '('}}
76 _Static_assert(1, "");
77 _Static_assert(0, ""); // expected-error {{static assertion failed}}