blob: 1544be52f255bcd0249aecdbe5e0004387ad594f [file] [log] [blame]
Aaron Ballmanbf5cf8c2013-07-22 17:55:04 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Fariborz Jahanianf4aa2792011-06-27 21:12:03 +00002// rdar://9584012
3
4typedef struct {
5 char *str;
6} Class;
7
8typedef union {
9 Class *object;
10} Instance __attribute__((transparent_union));
11
12__attribute__((nonnull(1))) void Class_init(Instance this, char *str) {
13 this.object->str = str;
14}
15
16int main(void) {
17 Class *obj;
18 Class_init(0, "Hello World"); // expected-warning {{null passed to a callee which requires a non-null argument}}
19 Class_init(obj, "Hello World");
20}
21