This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH for 3.3/3.4/3.5] Fix PR16175
- From: Kriang Lerdsuwanakij <lerdsuwa at users dot sourceforge dot net>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 21 Jul 2004 22:20:34 +0700 (ICT)
- Subject: Re: [C++ PATCH for 3.3/3.4/3.5] Fix PR16175
- Reply-to: <lerdsuwa at users dot sourceforge dot net>
Kriang Lerdsuwanakij wrote:
> Hi
>
> The PR16175 is simply about cv qualifiers not displayed in the
> diagnostics for BOUND_TEMPLATE_TEMPLATE_PARM tree nodes. I am
> committing this patch to mainline as obvious (tested on i686-pc-linux-gnu).
>
> The bug has been around since the beginning of template template parameter
> support but PR is recorded as regression simply due to a different error
> message was displayed in old versions of GCC. Anyway, I think it is safe
> and can be included in 3.3 and 3.4 branch. OK for 3.3 and 3.4?
I forgot to mention that the code for 3.3 and 3.4 differ slightly.
Here is the version I committed to the 3.4 branch (bootstrapped and
tested of course). For 3.3 branch the change is the same but the
surrounding lines printing identifier and template argument list also differ.
So this patch also requires a slight tweak there.
--Kriang
diff -cprN gcc-34-save/gcc/cp/error.c gcc-34-new/gcc/cp/error.c
*** gcc-34-save/gcc/cp/error.c Sat Jun 12 18:53:43 2004
--- gcc-34-new/gcc/cp/error.c Wed Jul 21 19:06:25 2004
*************** dump_type (tree t, int flags)
*** 359,364 ****
--- 359,365 ----
case BOUND_TEMPLATE_TEMPLATE_PARM:
{
tree args = TYPE_TI_ARGS (t);
+ dump_qualifiers (t, after);
pp_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
pp_template_argument_list_start (cxx_pp);
dump_template_argument_list (args, flags);
diff -cprN gcc-34-save/gcc/testsuite/g++.dg/template/ttp10.C gcc-34-new/gcc/testsuite/g++.dg/template/ttp10.C
*** gcc-34-save/gcc/testsuite/g++.dg/template/ttp10.C Thu Jan 1 07:00:00 1970
--- gcc-34-new/gcc/testsuite/g++.dg/template/ttp10.C Wed Jul 21 19:04:10 2004
***************
*** 0 ****
--- 1,21 ----
+ // { dg-do compile }
+
+ // Origin: Ivan Godard <igodard@pacbell.net>
+ // Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+ // PR c++/16175: Missing cv qualifier in error message output
+
+ template <typename> struct Template {};
+
+ template<template<typename> class D>
+ struct B {
+ static void foo1(const D<void> *); // { dg-error "const" }
+ static void foo2(volatile D<void> *);// { dg-error "volatile" }
+ };
+
+ class E : protected B<Template> {};
+
+ void bar() {
+ E::foo1 (0); // { dg-error "context" }
+ E::foo2 (0); // { dg-error "context" }
+ }