diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-01-23 17:53:04 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-01-23 17:53:04 +0000 |
commit | 9660803cd332d5c605899435019bb3b37fca3acc (patch) | |
tree | e5ad1a94e713715aefe57f51e5c229964d8f6e15 /test/Sema/uninit-variables.c | |
parent | e00909a6e997ec33d9baa5312e9d27b52a3da770 (diff) |
Teach -Wuninitialized-experimental about sizeof().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124076 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r-- | test/Sema/uninit-variables.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c index aed7a70966..faf94c024b 100644 --- a/test/Sema/uninit-variables.c +++ b/test/Sema/uninit-variables.c @@ -180,3 +180,15 @@ MyInt test26() { MyInt x; // expected-warning{{use of uninitialized variable 'x'}} expected-note{{add initialization to silence this warning}} return x; // expected-note{{variable 'x' is possibly uninitialized when used here}} } + +// Test handling of sizeof(). +int test27() { + struct test_27 { int x; } *y; + return sizeof(y->x); // no-warning +} + +int test28() { + int len; // expected-warning{{use of uninitialized variable 'len'}} expected-note{{add initialization to silence this warning}} + return sizeof(int[len]); // expected-note{{variable 'len' is possibly uninitialized when used here}} +} + |