re PR c++/57831 (pointer to member function inaccessible through using statement...
authorJason Merrill <jason@redhat.com>
Tue, 9 Jul 2013 17:55:24 +0000 (13:55 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 9 Jul 2013 17:55:24 +0000 (13:55 -0400)
PR c++/57831
* pt.c (tsubst_copy): Handle USING_DECL.

From-SVN: r200839

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/using23.C [new file with mode: 0644]

index 9262813ef2eb6516309280c54b93e4f7f5f8fb55..aa6bdb1f3394c97abe872d80e8cfbcd273228fb3 100644 (file)
@@ -1,3 +1,8 @@
+2013-07-09  Jason Merrill  <jason@redhat.com>
+
+       PR c++/57831
+       * pt.c (tsubst_copy): Handle USING_DECL.
+
 2013-07-09  Marc Glisse  <marc.glisse@inria.fr>
 
        PR c++/53094
index 26d5a1c5daabee6ecfacb50561f03eaeb6481387..23229a98d3625bc326d12b008a15fa61fe9029be 100644 (file)
@@ -12552,6 +12552,9 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
     case TYPE_DECL:
       return tsubst (t, args, complain, in_decl);
 
+    case USING_DECL:
+      t = DECL_NAME (t);
+      /* Fall through.  */
     case IDENTIFIER_NODE:
       if (IDENTIFIER_TYPENAME_P (t))
        {
diff --git a/gcc/testsuite/g++.dg/template/using23.C b/gcc/testsuite/g++.dg/template/using23.C
new file mode 100644 (file)
index 0000000..abb90de
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/57831
+
+struct A {
+  void f();
+};
+template <class T> struct B : T {
+  typedef T base;
+  using base::f;         // If I write "using B<T>::f" it's ok
+  void g( ) {
+    B<T>::f();           // This is OK as expected
+    (this->*&T::f)();    // This is also OK
+    (this->*&B<T>::f)(); // This causes error
+  }
+};
+template struct B< A >;