Template instantiation for static data members that are defined out-of-line.

Note that this also fixes a bug that affects non-template code, where we 
were not treating out-of-line static data members are "file-scope" variables,
and therefore not checking their initializers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77002 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 66e73f9..98d1f4c 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -5780,10 +5780,17 @@
   }
   
   if (VarDecl *Var = dyn_cast<VarDecl>(D)) {
-    (void)Var;
-    // FIXME: implicit template instantiation
+    // Implicit instantiation of static data members of class templates.
+    // FIXME: distinguish between implicit instantiations (which we need to
+    // actually instantiate) and explicit specializations.
+    if (Var->isStaticDataMember() && 
+        Var->getInstantiatedFromStaticDataMember())
+      PendingImplicitInstantiations.push_back(std::make_pair(Var, Loc));
+    
     // FIXME: keep track of references to static data?
+
     D->setUsed(true);
-  }
+    return;
+}
 }