If a static data member of a class template which could be used in a constant
expression is referenced, defined, then referenced again, make sure we
instantiate it the second time it's referenced. This is the static data member
analogue of r150518.

llvm-svn: 150560
diff --git a/clang/test/SemaTemplate/constexpr-instantiate.cpp b/clang/test/SemaTemplate/constexpr-instantiate.cpp
index 69ac0e4..316b088 100644
--- a/clang/test/SemaTemplate/constexpr-instantiate.cpp
+++ b/clang/test/SemaTemplate/constexpr-instantiate.cpp
@@ -57,3 +57,11 @@
   S<4> &k = g(0);
   int *p, *q = h(p);
 }
+
+namespace DataMember {
+  template<typename T> struct S { static const int k; };
+  const int n = S<int>::k; // expected-note {{here}}
+  template<typename T> const int S<T>::k = 0;
+  constexpr int m = S<int>::k; // ok
+  constexpr int o = n; // expected-error {{constant expression}} expected-note {{initializer of 'n'}}
+}