2013-03-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/52688
* g++.dg/template/static33.C: New.
* g++.dg/template/static34.C: Likewise.
PR c++/10291
* g++.dg/template/static35.C: New.
From-SVN: r196405
+2013-03-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/52688
+ * g++.dg/template/static33.C: New.
+ * g++.dg/template/static34.C: Likewise.
+
+ PR c++/10291
+ * g++.dg/template/static35.C: New.
+
2013-03-01 Steve Ellcey <sellcey@mips.com>
* gcc.dg/pr56396.c: Require pic support.
--- /dev/null
+// 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>();
+}
--- /dev/null
+// 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();
+}
--- /dev/null
+// 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>();
+}