xref: /llvm-project/clang/test/Sema/flexible-array-in-union.c (revision 8f8e450b668219c211284b68c36ba25b3193a2b0)
1 // RUN: %clang_cc1 %s -verify=c -fsyntax-only
2 // RUN: %clang_cc1 %s -verify -fsyntax-only -x c++
3 // RUN: %clang_cc1 %s -verify -fsyntax-only -fms-compatibility
4 // RUN: %clang_cc1 %s -verify -fsyntax-only -fms-compatibility -x c++
5 
6 // The test checks that an attempt to initialize union with flexible array
7 // member with an initializer list doesn't crash clang.
8 
9 
10 union { char x[]; } r = {0}; // c-error {{flexible array member 'x' in a union is not allowed}}
11 
12 // expected-no-diagnostics
13 
14