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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150560 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/constexpr-instantiate.cpp b/test/SemaTemplate/constexpr-instantiate.cpp
index 69ac0e4..316b088 100644
--- a/test/SemaTemplate/constexpr-instantiate.cpp
+++ b/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'}}
+}