brintos

brintos / llvm-project-archived public Read only

0
0
Text · 883 B · 5537876 Raw
38 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3// Test only flexible array member functionality specific to C++.4 5union VariableSizeUnion {6  int s;7  char c[];8};9 10@interface LastUnionIvar {11  VariableSizeUnion flexible;12}13@end14 15@interface NotLastUnionIvar {16  VariableSizeUnion flexible; // expected-error {{field 'flexible' with variable sized type 'VariableSizeUnion' is not at the end of class}}17  int last; // expected-note {{next instance variable declaration is here}}18}19@end20 21 22class VariableSizeClass {23public:24  int s;25  char c[];26};27 28@interface LastClassIvar {29  VariableSizeClass flexible;30}31@end32 33@interface NotLastClassIvar {34  VariableSizeClass flexible; // expected-error {{field 'flexible' with variable sized type 'VariableSizeClass' is not at the end of class}}35  int last; // expected-note {{next instance variable declaration is here}}36}37@end38