xref: /llvm-project/clang/test/Analysis/uninit-vals-union.c (revision ffe7950ebc62380c3afc7c71f454a1db3f6f5c76)
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core.builtin -verify -Wno-unused %s
2 
3 typedef union {
4   int y;
5 } U;
6 
7 typedef struct { int x; } A;
8 
foo(void)9 void foo(void) {
10   U u = {};
11   A *a = &u; // expected-warning{{incompatible pointer types}}
12   a->x;      // no-crash
13 }
14