re PR c++/2094 (unimplemented: use of `ptrmem_cst' in template type unification)
authorGiovanni Bajo <giovannibajo@libero.it>
Fri, 14 Nov 2003 05:13:45 +0000 (06:13 +0100)
committerBernardo Innocenti <bernie@gcc.gnu.org>
Fri, 14 Nov 2003 05:13:45 +0000 (06:13 +0100)
        PR c++/2094
        * g++.dg/template/ptrmem7.C: New test.

From-SVN: r73578

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/ptrmem7.C [new file with mode: 0644]

index a9590799c44b7aef34aefffc76b2f0dbe42438dc..845b6f11c7f8aa034a5d6b273cf8c948bb6dc9d0 100644 (file)
@@ -1,3 +1,8 @@
+2003-11-14  Giovanni Bajo  <giovannibajo@libero.it>
+
+        PR c++/2094
+        * g++.dg/template/ptrmem7.C: New test.
+
 2003-11-13  Andrew Pinski <apinski@apple.com>
 
        * gcc.c-torture/compile/20031113-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/template/ptrmem7.C b/gcc/testsuite/g++.dg/template/ptrmem7.C
new file mode 100644 (file)
index 0000000..59b28a3
--- /dev/null
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// Origin: <togawa at acm dot arg>
+// c++/2094: unsupported 'ptrmem_cst' in type unification
+
+struct R
+{
+  int i;
+};
+
+struct S
+{
+  int i;
+  int j;
+};
+
+struct S2 : S
+{};
+
+template<int S::*p, typename>
+struct X
+{
+  X ();
+  template<typename U> X(const X<p,U> &);
+};
+
+X<&S::i,S> x  = X<&S::i,S>();
+X<&S::i,S> x2 = X<&S2::i,S>();
+X<&S::i,S> y  = X<&S::j,S>();  // { dg-error "" }
+X<&S::i,S> z  = X<&R::i,S>();  // { dg-error "" }
+
+template <class T>
+struct Foo
+{
+  void foo(void)
+  {
+     X<&T::i,T> x  = X<&T::i,T>();
+     X<&S::i,S> x2 = X<&S2::i,S>();
+     X<&S::i,S> y  = X<&S::j,S>(); // { dg-error "" }
+     X<&S::i,S> z  = X<&R::i,S>(); // { dg-error "" }
+  }
+};
+
+template struct Foo<S>;  // { dg-error "instantiated from" }