This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR c++/42218
- From: Dodji Seketeli <dodji at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: jason at redhat dot com
- Date: Thu, 3 Dec 2009 19:24:27 +0100
- Subject: [PATCH] PR c++/42218
Hello,
In this PR we try to print the entire set of template arguments of the
unqualified part a template-id. The patch below changes that to just print
the innermost template arguments for that unqualified-id.
I am currently testing it against trunk on x86_64-unknown-linux-gnu.
OK if it it passes regstrap ?
Thanks.
Dodji
commit f86c445d05e3d9756bb3f3674b2f2cdd079dea42
Author: Dodji Seketeli <dodji@redhat.com>
Date: Thu Dec 3 19:12:34 2009 +0100
Fix PR c++/42218
gcc/cp/ChangeLog:
* cxx-pretty-print.c (pp_cxx_unqualified_id): Print only innermost
template arguments.
gcc/testsuite/ChangeLog:
PR c++/42218
* g++.dg/other/error33.C: New test.
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 305b7ed..5ef84fe 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -203,7 +203,8 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
if (CLASS_TYPE_P (t) && CLASSTYPE_USE_TEMPLATE (t))
{
pp_cxx_begin_template_argument_list (pp);
- pp_cxx_template_argument_list (pp, CLASSTYPE_TI_ARGS (t));
+ pp_cxx_template_argument_list (pp, INNERMOST_TEMPLATE_ARGS
+ (CLASSTYPE_TI_ARGS (t)));
pp_cxx_end_template_argument_list (pp);
}
break;
diff --git a/gcc/testsuite/g++.dg/other/error33.C b/gcc/testsuite/g++.dg/other/error33.C
new file mode 100644
index 0000000..6cd3b84
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/error33.C
@@ -0,0 +1,11 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/42218
+// { dg-do compile }
+
+template<int> struct A
+{
+ template<int> struct B;
+};
+
+int i = A<0>::B<0>::X::Y; // { dg-error "has not been declared" }
+