re PR c++/17154 (Using declaration of function name ignored inside partial specializa...
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Thu, 6 Jan 2005 16:04:05 +0000 (16:04 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Thu, 6 Jan 2005 16:04:05 +0000 (16:04 +0000)
PR c++/17154
* search.c (lookup_field_1): Handle using declaration in
class template partial specialization.

* g++.dg/template/using9.C: New test.

From-SVN: r92994

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

index 628d046c835110f3f822f9acda0e4857856ee5d5..600e94502cf5259b0d4c74034c66f0e71afda89e 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-06  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/17154
+       * search.c (lookup_field_1): Handle using declaration in
+       class template partial specialization.
+
 2005-01-06  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/19258
index 8c26565147aa8f7c18903355916961ede68549a3..8d5ae655ceae10bbcf115ef3f27992f51ff683d9 100644 (file)
@@ -1,7 +1,7 @@
 /* Breadth-first and depth-first routines for
    searching multiple-inheritance lattice for GNU C++.
    Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GCC.
@@ -470,13 +470,10 @@ lookup_field_1 (tree type, tree name, bool want_type)
             the compiler cannot handle that.  Once the class is
             defined, USING_DECLs are purged from TYPE_FIELDS; see
             handle_using_decl.  However, we make special efforts to
-            make using-declarations in template classes work
-            correctly.  */
-         if (CLASSTYPE_TEMPLATE_INFO (type)
-             && !CLASSTYPE_USE_TEMPLATE (type)
-             && !TREE_TYPE (field))
-           ;
-         else
+            make using-declarations in class templates and class
+            template partial specializations work correctly noticing
+            that dependent USING_DECL's do not have TREE_TYPE set.  */
+         if (TREE_TYPE (field))
            continue;
        }
 
index 8ed16ad930f095f569648bae810a5e52c5928795..de33069a9b8b5a5dc9f4cbba516ecda60f309830 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-06  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/17154
+       * g++.dg/template/using9.C: New test.
+
 2005-01-06  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/19258
diff --git a/gcc/testsuite/g++.dg/template/using9.C b/gcc/testsuite/g++.dg/template/using9.C
new file mode 100644 (file)
index 0000000..a2c06a7
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-do compile }
+
+// Origin: stefaandr@hotmail.com
+
+// PR c++/17154: Using declaration in partial class template specialization.
+
+template <int numrows, class T> struct A { void test_A() {}; };
+template <int numrows, class T> struct B {};
+template <class T> struct B <3, T> : public A <3, T> {
+       using A <3, T>::test_A;
+       void test_B_spec() { test_A(); };
+};