diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-04-12 20:03:47 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-04-12 20:03:47 +0000 |
commit | c02af35e92909d672b67efee407d2cee6d6d86e5 (patch) | |
tree | 7f46c8bbaad880837f991673f7c7862c7946dfdf /test/SemaCXX | |
parent | 55331da3211151aa67277aa095b7d301342200d4 (diff) |
Add -Wuninitialized test for C++11 lambdas.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/uninitialized.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/SemaCXX/uninitialized.cpp b/test/SemaCXX/uninitialized.cpp index 15c06eb421..7879e7c753 100644 --- a/test/SemaCXX/uninitialized.cpp +++ b/test/SemaCXX/uninitialized.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -Wall -Wuninitialized -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wall -Wuninitialized -std=c++11 -verify %s int foo(int x); int bar(int* x); @@ -162,3 +162,8 @@ int pr12325(int params) { return x; } +// Test lambda expressions with -Wuninitialized +int test_lambda() { + auto f1 = [] (int x, int y) { int z; return x + y + z; }; // expected-warning {{C++11 requires lambda with omitted result type to consist of a single return statement}} expected-warning{{variable 'z' is uninitialized when used here}} expected-note {{initialize the variable 'z' to silence this warning}} + return f1(1, 2); +} |