]> granicus.if.org Git - clang/commitdiff
When we resolve the type of an 'auto' variable, clear out the linkage
authorDouglas Gregor <dgregor@apple.com>
Mon, 20 Feb 2012 20:05:29 +0000 (20:05 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 20 Feb 2012 20:05:29 +0000 (20:05 +0000)
of that variable; it will need to be recomputed with the resolved
type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150984 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/CodeGenCXX/lambda-expressions.cpp

index f385b50c3a275952c8243d9130815a9a7f622977..6c54424c97652a810fb783f1e5c9df6b6f256db2 100644 (file)
@@ -6101,7 +6101,8 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
     }
     VDecl->setTypeSourceInfo(DeducedType);
     VDecl->setType(DeducedType->getType());
-
+    VDecl->ClearLinkageCache();
+    
     // In ARC, infer lifetime.
     if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(VDecl))
       VDecl->setInvalidDecl();
index 203ca4d805c81848d8006409ce1b30527097e0f3..6f0fa87bb1416a86ec0e5112003ead46e72f8fe7 100644 (file)
@@ -1,5 +1,8 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 | FileCheck %s
 
+// CHECK: @var = internal global
+auto var = [](int i) { return i+1; };
+
 int a() { return []{ return 1; }(); }
 // CHECK: define i32 @_Z1av
 // CHECK: call i32 @_ZZ1avENKUlvE_clEv