This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch][c++/PR 32112]
- From: Dave Brolley <brolley at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 29 Jun 2007 17:16:50 -0400
- Subject: [patch][c++/PR 32112]
Here is a patch, ChangeLog and test case for this problem. The patch
adds the handling of UNBOUND_CLASS_TEMPLATE to dump_decl and
pp_cxx_unqualified_id allowing for the generation of the expected messages:
32112.C:5: error: i is not a template
32112.C:5: error: type/value mismatch at argument 1 in template
parameter list for template<class> struct A
32112.C:5: error: expected a type, got & T::i
This patch causes no regressions to 'make check-gcc'.
Dave
2007-06-29 Dave Brolley <brolley@redhat.com>
PR c++/32112
* error.c (dump_decl): Handle UNBOUND_CLASS_TEMPLATE.
* cxx-pretty-print.c (pp_cxx_unqualified_id): Likewise.
Index: gcc/cp/error.c
===================================================================
--- gcc/cp/error.c (revision 125888)
+++ gcc/cp/error.c (working copy)
@@ -910,6 +910,10 @@
}
break;
+ case UNBOUND_CLASS_TEMPLATE:
+ pp_cxx_tree_identifier (cxx_pp, DECL_NAME (TYPE_NAME (t)));
+ break;
+
case LABEL_DECL:
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
break;
Index: gcc/cp/cxx-pretty-print.c
===================================================================
--- gcc/cp/cxx-pretty-print.c (revision 125888)
+++ gcc/cp/cxx-pretty-print.c (working copy)
@@ -206,6 +206,10 @@
pp_cxx_unqualified_id (pp, TEMPLATE_PARM_DECL (t));
break;
+ case UNBOUND_CLASS_TEMPLATE:
+ pp_cxx_tree_identifier (pp, DECL_NAME (TYPE_NAME (t)));
+ break;
+
case TYPENAME_TYPE:
pp_cxx_unqualified_id (pp, TYPE_NAME (t));
break;
// PR c++/32112
template<typename> struct A;
template<typename T> void foo (A<&T::template i>); // { dg-error "is not a template" }