xref: /llvm-project/clang/test/Parser/compound_literal.c (revision 5c287efee77930ab15fe5579bed00b2750bbb254)
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -x c++ -Wno-dangling-assignment %s
3 // expected-no-diagnostics
main(void)4 int main(void) {
5   char *s;
6   // In C++ mode, the cast creates a "char [4]" array temporary here.
7   s = (char []){"whatever"};  // dangling!
8   s = (char(*)){s};
9 }
10