===================================================================
@@ -0,0 +1,18 @@
+// PR c++/52688
+// { dg-do link }
+
+template<typename T>
+T f()
+{
+ static const double staticLocalVariable = 100.0;
+ struct local
+ {
+ static double f() { return staticLocalVariable; }
+ };
+ return T(local::f());
+}
+
+int main()
+{
+ f<double>();
+}
===================================================================
@@ -0,0 +1,21 @@
+// PR c++/52688
+// { dg-do link }
+
+template<class T>
+struct A {
+ static bool test() {
+ static bool value = false;
+ if (value)
+ return false;
+ struct S {
+ S() { value = true; }
+ };
+ static S s;
+ return true;
+ }
+};
+
+int main()
+{
+ A<int>::test();
+}
===================================================================
@@ -0,0 +1,21 @@
+// PR c++/10291
+// { dg-do link }
+
+template <class T>
+int foo ()
+{
+ static int i;
+
+ struct S {
+ int bar () {
+ return i;
+ }
+ } s;
+
+ return s.bar ();
+}
+
+int main ()
+{
+ foo<int>();
+}