This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix PR16806, error-recovery on the 3.3 branch
- From: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: gdr at gcc dot gnu dot org
- Date: Wed, 15 Dec 2004 17:07:02 +0100 (CET)
- Subject: [patch] Fix PR16806, error-recovery on the 3.3 branch
When trying to produce an error message for the following invalid code
snippet the 3.3 branch compiler gets hiccups:
-----------------------------------
struct A
{
template<int> int foo();
};
void operator << (const A&, int);
void bar()
{
A() << A().foo<0>;
}
-----------------------------------
bug.cc: In function `void bar()':
bug.cc:10: error: no match for 'operator<<' in 'A() <<
Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report, [etc.]
This is because we fail to print the name of the template function
in dump_expr in cp/error.c.
The following patch fixes that by recursing into dump_expr (backported
from mainline). With this patch I now get:
bug.cc: In function `void bar()':
bug.cc:10: error: no match for 'operator<<' in 'A() << A().foo<0>'
bug.cc:6: error: candidates are: void operator<<(const A&, int)
Bootstrapped and regtested on i686-pc-linux-gnu.
Ok to apply to the 3.3 branch?
Regards,
Volker
2004-12-15 Volker Reichelt <igpm.rwth-aachen.de>
PR c++/16806
* error.c (dump_expr) [BASELINK]: Use dump_expr.
===================================================================
diff -u -p -r1.192.2.10 error.c
--- gcc/gcc/cp/error.c 10 Dec 2004 17:02:31 -0000 1.192.2.10
+++ gcc/gcc/cp/error.c 15 Dec 2004 12:09:57 -0000
@@ -2071,7 +2071,7 @@ dump_expr (t, flags)
break;
case BASELINK:
- print_tree_identifier (scratch_buffer, DECL_NAME (get_first_fn (t)));
+ dump_expr (get_first_fn (t), flags & ~TFF_EXPR_IN_PARENS);
break;
case TREE_LIST:
===================================================================