This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix PR c++/21686: Broken quotation in error message
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 24 May 2005 04:17:32 +0200
- Subject: Re: [patch] Fix PR c++/21686: Broken quotation in error message
- References: <200505240033.j4O0XMOO003284@relay.rwth-aachen.de>
Volker Reichelt <reichelt@igpm.rwth-aachen.de> writes:
| On mainline and the 4.0 branch we get the error message
|
| PR21686.cc: In constructor 'foo()::A::A()':
| PR21686.cc:4: error: use of %<auto%> variable from containing function
| PR21686.cc:3: error: 'int i' declared here
|
| for the code snippet
|
| void foo()
| {
| int i;
| struct A { A() { i; } };
| }
|
| Note the broken quotation of "auto". This is due to the following code
| in cp/semantics.c:
|
| error ("use of %s from containing function",
| (TREE_CODE (decl) == VAR_DECL
| ? "%<auto%> variable" : "parameter"));
|
| The quotation with %< %> just doesn't work in strings substituted by %s.
| The attached patch fixes the quotation by not using substitution.
| The error message then reads as expected:
|
| PR21686.cc: In constructor 'foo()::A::A()':
| PR21686.cc:4: error: use of 'auto' variable from containing function
| PR21686.cc:3: error: 'int i' declared here
And it is more suitable for translation -- we should avoid those kinds of
substituion in the C++ front-end.
| Bootstrapped and regtested on i686-pc-linux-gnu.
| OK for 4.0 branch and mainline?
As far as I'm concerned, it is OK.
| Should I wait for the unslushing of mainline, although this is a regression?
As I understand mainline is blocked only for non-regression fixes.
-- Gaby