PR19996: don't crash if -Wuninitialized sees a c++1y lambda init-capture.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 11 Jun 2014 00:31:00 +0000 (00:31 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 11 Jun 2014 00:31:00 +0000 (00:31 +0000)
llvm-svn: 210615

clang/lib/Analysis/UninitializedValues.cpp
clang/test/SemaCXX/uninit-variables.cpp

index 4b8a59c..f5c786a 100644 (file)
@@ -34,7 +34,7 @@ using namespace clang;
 
 static bool isTrackedVar(const VarDecl *vd, const DeclContext *dc) {
   if (vd->isLocalVarDecl() && !vd->hasGlobalStorage() &&
-      !vd->isExceptionVariable() &&
+      !vd->isExceptionVariable() && !vd->isInitCapture() &&
       vd->getDeclContext() == dc) {
     QualType ty = vd->getType();
     return ty->isScalarType() || ty->isVectorType();
index 687bfd2..4dcd348 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only -fcxx-exceptions %s -verify
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only -fcxx-exceptions %s -verify -std=c++1y
 
 // Stub out types for 'typeid' to work.
 namespace std { class type_info {}; }
@@ -147,3 +147,6 @@ int test_const_ref() {
   consume_const_ref(n);
   return n; // expected-warning {{uninitialized when used here}}
 }
+
+// Don't crash here.
+auto PR19996 = [a=0]{int t; return a;};