Patchwork [C++,testcase] PR 53581

login
register
mail settings
Submitter Paolo Carlini
Date Oct. 14, 2012, 6:26 p.m.
Message ID <507B03BB.5080303@oracle.com>
Download mbox | patch
Permalink /patch/191376/
State New
Headers show

Comments

Paolo Carlini - Oct. 14, 2012, 6:26 p.m.
Hi,

testcase added, issue closed as fixed. Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////
2012-10-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53581
	* g++.dg/template/crash113.C: New.

Patch

Index: g++.dg/template/crash113.C
===================================================================
--- g++.dg/template/crash113.C	(revision 0)
+++ g++.dg/template/crash113.C	(working copy)
@@ -0,0 +1,50 @@ 
+// PR c++/53581
+
+template<class A, int M, int N>
+class Child;
+
+template<class A, int M, int N>
+class Base
+{
+public:
+  Child<A, M, N> operator-(const Base<A, M, N> &m) const
+  {
+    Child<A, M, N> diff;
+    return diff;
+  }
+
+  A test() const
+  {
+    return 0;
+  }
+
+private:
+  A values[M * N];
+};
+
+template<class A, int N>
+class Ops
+{
+public:
+  virtual ~Ops() {}
+
+  bool bar() const
+  {
+    Child<A, N, N> mat;
+    return (*static_cast<const Child<A, N, N>*>(this) - mat).test();
+  }
+};
+
+
+template<class A, int N>
+class Child<A, N, N> : public Base<A, N, N>, public Ops<A, N> {};
+
+class ImageWarp
+{
+  bool bar() const
+  {
+    return foo.bar();
+  }
+
+  Child<float, 3, 3> foo;
+};