brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 12ee2f9 Raw
81 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -Wno-objc-root-class %s3 4#if __has_feature(objc_c_static_assert)5#error failed6#endif7#if !__has_extension(objc_c_static_assert)8#error failed9#endif10 11#if __cplusplus >= 201103L12 13#if !__has_feature(objc_cxx_static_assert)14#error failed15#endif16 17// C++1118 19@interface A {20  int a;21  static_assert(1, "");22  _Static_assert(1, "");23 24  static_assert(0, ""); // expected-error {{static assertion failed}}25  _Static_assert(0, ""); // expected-error {{static assertion failed}}26 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'}}31}32 33static_assert(1, "");34_Static_assert(1, "");35 36- (void)f;37@end38 39@implementation A {40  int b;41  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'}}46}47 48static_assert(1, "");49 50- (void)f {51  static_assert(1, "");52}53@end54 55@interface B56@end57 58@interface B () {59  int b;60  static_assert(sizeof(b) == 4, "");61  static_assert(sizeof(b) == 3, ""); // expected-error {{static assertion failed}} \62                                     // expected-note {{evaluates to '4 == 3'}}63}64@end65 66#else67 68#if __has_feature(objc_cxx_static_assert)69#error failed70#endif71 72// C++9873@interface A {74  int a;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}}78}79@end80#endif81