diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-17 00:06:14 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-17 00:06:14 +0000 |
commit | 9532e0d89ca2afa556f032aa9377f6ec1d3eaa3e (patch) | |
tree | e07d0329178ac5601de45085bf65fe3d8534548d /test/SemaCXX/uninit-variables.cpp | |
parent | 89e5aaf57e20b39e35b0d068ebbc09ae736f2e1e (diff) |
-Wuninitialized: Split the classification of DeclRefExprs as initialization or
use out of TransferFunctions, and compute it in advance rather than on-the-fly.
This allows us to handle compound assignments with DeclRefExprs on the RHS
correctly, and also makes it trivial to treat const& function parameters as not
initializing the argument. The patch also makes both of those changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160330 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/uninit-variables.cpp')
-rw-r--r-- | test/SemaCXX/uninit-variables.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/SemaCXX/uninit-variables.cpp b/test/SemaCXX/uninit-variables.cpp index eb6428d631..687bfd2638 100644 --- a/test/SemaCXX/uninit-variables.cpp +++ b/test/SemaCXX/uninit-variables.cpp @@ -141,3 +141,9 @@ void test_bitcasts_2() { int y = (float &)x; // expected-warning {{uninitialized when used here}} } +void consume_const_ref(const int &n); +int test_const_ref() { + int n; // expected-note {{variable}} + consume_const_ref(n); + return n; // expected-warning {{uninitialized when used here}} +} |