aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/uninit-variables.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-08-04 22:40:57 +0000
committerTed Kremenek <kremenek@apple.com>2011-08-04 22:40:57 +0000
commit57fb591a54eab7db65d73e77c632f047bca22c54 (patch)
tree04017173ff6b9386622f0d574a9e479ee66b044e /test/SemaCXX/uninit-variables.cpp
parent62a811d171fd16cb45b4617be40d10aec8578c07 (diff)
Fix assertion failure in -Wuninitialized involving no-op casts. Fixes PR 10577.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/uninit-variables.cpp')
-rw-r--r--test/SemaCXX/uninit-variables.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaCXX/uninit-variables.cpp b/test/SemaCXX/uninit-variables.cpp
index a850a2f92f..6c5d0068a4 100644
--- a/test/SemaCXX/uninit-variables.cpp
+++ b/test/SemaCXX/uninit-variables.cpp
@@ -118,4 +118,15 @@ void RDar9251392() {
}
}
+// Test handling of "no-op" casts.
+void test_noop_cast()
+{
+ int x = 1;
+ int y = (int&)x; // no-warning
+}
+
+void test_noop_cast2() {
+ int x; // expected-note {{declared here}} expected-note {{add initialization}}
+ int y = (int&)x; // expected-warning {{uninitialized when used here}}
+}