This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[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: Tue, 20 Jul 2004 23:14:20 +0700 (ICT)
- Subject: [C++ PATCH for 3.3/3.4/3.5] Fix PR16175
- Reply-to: <lerdsuwa at users dot sourceforge dot net>
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?
--Kriang
2004-07-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/16175
* error.c (dump_type) <BOUND_TEMPLATE_TEMPLATE_PARM case>: Output
cv qualifier.
2004-07-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/16175
* g++.dg/template/ttp10.C: New test.
diff -cprN gcc-main-save/gcc/cp/error.c gcc-main-new/gcc/cp/error.c
*** gcc-main-save/gcc/cp/error.c Mon Jul 19 23:28:57 2004
--- gcc-main-new/gcc/cp/error.c Mon Jul 19 22:28:02 2004
*************** dump_type (tree t, int flags)
*** 316,321 ****
--- 316,322 ----
case BOUND_TEMPLATE_TEMPLATE_PARM:
{
tree args = TYPE_TI_ARGS (t);
+ pp_cxx_cv_qualifier_seq (cxx_pp, t);
pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
pp_cxx_begin_template_argument_list (cxx_pp);
dump_template_argument_list (args, flags);
diff -cprN gcc-main-save/gcc/testsuite/g++.dg/template/ttp10.C gcc-main-new/gcc/testsuite/g++.dg/template/ttp10.C
*** gcc-main-save/gcc/testsuite/g++.dg/template/ttp10.C Thu Jan 1 07:00:00 1970
--- gcc-main-new/gcc/testsuite/g++.dg/template/ttp10.C Mon Jul 19 22:51:46 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" }
+ }