diff mbox

[C++,testcases,committed] PR 10291, PR 52688

Message ID 5131E0AE.5080403@oracle.com
State New
Headers show

Commit Message

Paolo Carlini March 2, 2013, 11:21 a.m. UTC
Hi,

I added some testcases and closed the PRs as fixed for 4.8.0.

Thanks,
Paolo.

////////////////////
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.
diff mbox

Patch

Index: g++.dg/template/static33.C
===================================================================
--- g++.dg/template/static33.C	(revision 0)
+++ g++.dg/template/static33.C	(working copy)
@@ -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>();
+}
Index: g++.dg/template/static34.C
===================================================================
--- g++.dg/template/static34.C	(revision 0)
+++ g++.dg/template/static34.C	(working copy)
@@ -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();
+}
Index: g++.dg/template/static35.C
===================================================================
--- g++.dg/template/static35.C	(revision 0)
+++ g++.dg/template/static35.C	(working copy)
@@ -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>();
+}