summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/ptrmem23.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/template/ptrmem23.C')
-rw-r--r--gcc/testsuite/g++.dg/template/ptrmem23.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/ptrmem23.C b/gcc/testsuite/g++.dg/template/ptrmem23.C
new file mode 100644
index 000000000..28c0a63e5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ptrmem23.C
@@ -0,0 +1,22 @@
+// PR c++/56247
+
+struct Base {
+ void method() {}
+};
+
+typedef void (Base::*MemPtr)();
+
+// Template with a member function pointer "non-type parameter".
+template<MemPtr func>
+struct Wrapper {};
+
+template<class C>
+struct Child : public Base {
+ // Templated derived class instantiates the Wrapper with the same parameter
+ // in two different virtual methods.
+ void foo() { typedef Wrapper<&Base::method> W; }
+ void bar() { typedef Wrapper<&Base::method> W; }
+};
+
+// Instantiate Child with some type.
+template class Child<int>;