aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-05 02:09:15 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-05 02:09:15 +0000
commit782086f81ca240ce44b6045716b9e75160a98ee8 (patch)
treef4ac00f6323e57653d33af03809113217cdd5479
parent8d672f10a2ecf09223b46d099d4779b4bb6961db (diff)
* pt.c (retrieve_specialization): Don't get confused by avar-tracking-assignments-merge-149247-trunk
using-declaration that brings in another instance of this template from a base class. * ptree.c (cxx_print_type): Fix logic. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149247 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c5
-rw-r--r--gcc/cp/ptree.c4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/template/using15.C25
5 files changed, 43 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9953b2094e1..e3fe9c25b81 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2009-07-04 Jason Merrill <jason@redhat.com>
+ * pt.c (retrieve_specialization): Don't get confused by a
+ using-declaration that brings in another instance of this template
+ from a base class.
+
+ * ptree.c (cxx_print_type): Fix logic.
+
* cp-tree.h (LANG_DECL_FN_CHECK): Fix non-checking version.
PR c++/40619
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 527fe04f5a8..4143bb121d9 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -974,7 +974,10 @@ retrieve_specialization (tree tmpl, tree args, hashval_t hash)
for (fns = VEC_index (tree, methods, idx); fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
- if (DECL_TEMPLATE_INFO (fn) && DECL_TI_TEMPLATE (fn) == tmpl)
+ if (DECL_TEMPLATE_INFO (fn) && DECL_TI_TEMPLATE (fn) == tmpl
+ /* using-declarations can add base methods to the method vec,
+ and we don't want those here. */
+ && DECL_CONTEXT (fn) == class_specialization)
return fn;
}
return NULL_TREE;
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index ec7a4712ba1..69279cd4883 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -91,6 +91,10 @@ cxx_print_type (FILE *file, tree node, int indent)
print_node (file, "throws", TYPE_RAISES_EXCEPTIONS (node), indent + 4);
return;
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ break;
+
default:
return;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1582c882dac..da27711cf66 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-04 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/template/using15.C: New.
+
2009-07-04 Jakub Jelinek <jakub@redhat.com>
* gfortran.dg/maxloc_1.f90: New test.
diff --git a/gcc/testsuite/g++.dg/template/using15.C b/gcc/testsuite/g++.dg/template/using15.C
new file mode 100644
index 00000000000..b158ac09cf6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/using15.C
@@ -0,0 +1,25 @@
+// Reduced from the testcase for c++/29433
+
+template <class T>
+struct A: T
+{
+ void f(typename T::type);
+ using T::f;
+ void g() { f(1); }
+};
+
+template <class T>
+struct B: T
+{ typedef int type; };
+
+struct C
+{
+ typedef double type;
+ void f();
+};
+
+int main()
+{
+ A<B<A<C> > > a;
+ a.g();
+}