[cfe-commits] r154608 - /cfe/trunk/test/SemaCXX/uninitialized.cpp
Ted Kremenek
kremenek at apple.com
Thu Apr 12 13:03:47 PDT 2012
Author: kremenek
Date: Thu Apr 12 15:03:47 2012
New Revision: 154608
URL: http://llvm.org/viewvc/llvm-project?rev=154608&view=rev
Log:
Add -Wuninitialized test for C++11 lambdas.
Modified:
cfe/trunk/test/SemaCXX/uninitialized.cpp
Modified: cfe/trunk/test/SemaCXX/uninitialized.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/uninitialized.cpp?rev=154608&r1=154607&r2=154608&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/uninitialized.cpp (original)
+++ cfe/trunk/test/SemaCXX/uninitialized.cpp Thu Apr 12 15:03:47 2012
@@ -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 @@
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);
+}
More information about the cfe-commits
mailing list