public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR80280: Fix quoting of candidate functions
@ 2017-05-06 23:55 Volker Reichelt
  2017-05-07 19:23 ` Martin Sebor
  0 siblings, 1 reply; 3+ messages in thread
From: Volker Reichelt @ 2017-05-06 23:55 UTC (permalink / raw)
  To: gcc-patches, Martin Sebor

Hi,

the following patch fixes some wrong quoting that was introduced by
Martin's patch for PR translation/80280, see
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=247607

Consider the following testcase:
 struct A {};
 bool b = !A();

On trunk we currently get the following diagnostic:
 bug.cc:2:10: error: no match for 'operator!' (operand type is 'A')
  bool b = !A();
           ^~~~
 bug.cc:2:10: note: 'candidate: operator!(bool) <built-in>'
 bug.cc:2:10: note:   no known conversion for argument 1 from 'A' to 'bool'

Note, that not only the candidate function, but also the surrounding
text is quoted in the second-to-last line.

With the patch, this line reads:
 bug.cc:2:10: note: candidate: 'operator!(bool)' <built-in>

Bootstrapped and regtested on x86_64-pc-linux-gnu.

OK for trunk?

Regards,
Volker


2017-05-06  Volker Reichelt  <v.reichelt@netcologne.de>

	PR translation/80280
	* call.c (print_z_candidate): Fix quoting.

Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c	(revision 247720)
+++ gcc/cp/call.c	(working copy)
@@ -3457,16 +3457,16 @@
     {
       cloc = loc;
       if (candidate->num_convs == 3)
-	inform (cloc, "%<%s%D(%T, %T, %T) <built-in>%>", msg, fn,
+	inform (cloc, "%s%<%D(%T, %T, %T)%> <built-in>", msg, fn,
 		candidate->convs[0]->type,
 		candidate->convs[1]->type,
 		candidate->convs[2]->type);
       else if (candidate->num_convs == 2)
-	inform (cloc, "%<%s%D(%T, %T) <built-in>%>", msg, fn,
+	inform (cloc, "%s%<%D(%T, %T)%> <built-in>", msg, fn,
 		candidate->convs[0]->type,
 		candidate->convs[1]->type);
       else
-	inform (cloc, "%<%s%D(%T) <built-in>%>", msg, fn,
+	inform (cloc, "%s%<%D(%T)%> <built-in>", msg, fn,
 		candidate->convs[0]->type);
     }
   else if (TYPE_P (fn))
===================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PR80280: Fix quoting of candidate functions
  2017-05-06 23:55 [PATCH] PR80280: Fix quoting of candidate functions Volker Reichelt
@ 2017-05-07 19:23 ` Martin Sebor
  2017-05-07 20:03   ` Volker Reichelt
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Sebor @ 2017-05-07 19:23 UTC (permalink / raw)
  To: Volker Reichelt, gcc-patches, Martin Sebor

On 05/06/2017 02:41 PM, Volker Reichelt wrote:
> Hi,
>
> the following patch fixes some wrong quoting that was introduced by
> Martin's patch for PR translation/80280, see
> https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=247607
>
> Consider the following testcase:
>  struct A {};
>  bool b = !A();
>
> On trunk we currently get the following diagnostic:
>  bug.cc:2:10: error: no match for 'operator!' (operand type is 'A')
>   bool b = !A();
>            ^~~~
>  bug.cc:2:10: note: 'candidate: operator!(bool) <built-in>'
>  bug.cc:2:10: note:   no known conversion for argument 1 from 'A' to 'bool'
>
> Note, that not only the candidate function, but also the surrounding
> text is quoted in the second-to-last line.
>
> With the patch, this line reads:
>  bug.cc:2:10: note: candidate: 'operator!(bool)' <built-in>

This quoting looks better, thanks for the correction.  I would
say it falls under the obvious fix category.

Incidentally, the candidate for the test case (and other Boolean
expressions involving the struct) doesn't look very helpful or
even relevant, but that's a separate issue.

Martin

>
> Bootstrapped and regtested on x86_64-pc-linux-gnu.
>
> OK for trunk?
>
> Regards,
> Volker
>
>
> 2017-05-06  Volker Reichelt  <v.reichelt@netcologne.de>
>
> 	PR translation/80280
> 	* call.c (print_z_candidate): Fix quoting.
>
> Index: gcc/cp/call.c
> ===================================================================
> --- gcc/cp/call.c	(revision 247720)
> +++ gcc/cp/call.c	(working copy)
> @@ -3457,16 +3457,16 @@
>      {
>        cloc = loc;
>        if (candidate->num_convs == 3)
> -	inform (cloc, "%<%s%D(%T, %T, %T) <built-in>%>", msg, fn,
> +	inform (cloc, "%s%<%D(%T, %T, %T)%> <built-in>", msg, fn,
>  		candidate->convs[0]->type,
>  		candidate->convs[1]->type,
>  		candidate->convs[2]->type);
>        else if (candidate->num_convs == 2)
> -	inform (cloc, "%<%s%D(%T, %T) <built-in>%>", msg, fn,
> +	inform (cloc, "%s%<%D(%T, %T)%> <built-in>", msg, fn,
>  		candidate->convs[0]->type,
>  		candidate->convs[1]->type);
>        else
> -	inform (cloc, "%<%s%D(%T) <built-in>%>", msg, fn,
> +	inform (cloc, "%s%<%D(%T)%> <built-in>", msg, fn,
>  		candidate->convs[0]->type);
>      }
>    else if (TYPE_P (fn))
> ===================================================================
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PR80280: Fix quoting of candidate functions
  2017-05-07 19:23 ` Martin Sebor
@ 2017-05-07 20:03   ` Volker Reichelt
  0 siblings, 0 replies; 3+ messages in thread
From: Volker Reichelt @ 2017-05-07 20:03 UTC (permalink / raw)
  To: gcc-patches, Martin Sebor

OK, committed as obvious (r247728).

Regards,
Volker

On  7 May, Martin Sebor wrote:
> On 05/06/2017 02:41 PM, Volker Reichelt wrote:
>> Hi,
>>
>> the following patch fixes some wrong quoting that was introduced by
>> Martin's patch for PR translation/80280, see
>> https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=247607
>>
>> Consider the following testcase:
>>  struct A {};
>>  bool b = !A();
>>
>> On trunk we currently get the following diagnostic:
>>  bug.cc:2:10: error: no match for 'operator!' (operand type is 'A')
>>   bool b = !A();
>>            ^~~~
>>  bug.cc:2:10: note: 'candidate: operator!(bool) <built-in>'
>>  bug.cc:2:10: note:   no known conversion for argument 1 from 'A' to 'bool'
>>
>> Note, that not only the candidate function, but also the surrounding
>> text is quoted in the second-to-last line.
>>
>> With the patch, this line reads:
>>  bug.cc:2:10: note: candidate: 'operator!(bool)' <built-in>
> 
> This quoting looks better, thanks for the correction.  I would
> say it falls under the obvious fix category.
> 
> Incidentally, the candidate for the test case (and other Boolean
> expressions involving the struct) doesn't look very helpful or
> even relevant, but that's a separate issue.
> 
> Martin
> 
>>
>> Bootstrapped and regtested on x86_64-pc-linux-gnu.
>>
>> OK for trunk?
>>
>> Regards,
>> Volker
>>
>>
>> 2017-05-06  Volker Reichelt  <v.reichelt@netcologne.de>
>>
>> 	PR translation/80280
>> 	* call.c (print_z_candidate): Fix quoting.
>>
>> Index: gcc/cp/call.c
>> ===================================================================
>> --- gcc/cp/call.c	(revision 247720)
>> +++ gcc/cp/call.c	(working copy)
>> @@ -3457,16 +3457,16 @@
>>      {
>>        cloc = loc;
>>        if (candidate->num_convs == 3)
>> -	inform (cloc, "%<%s%D(%T, %T, %T) <built-in>%>", msg, fn,
>> +	inform (cloc, "%s%<%D(%T, %T, %T)%> <built-in>", msg, fn,
>>  		candidate->convs[0]->type,
>>  		candidate->convs[1]->type,
>>  		candidate->convs[2]->type);
>>        else if (candidate->num_convs == 2)
>> -	inform (cloc, "%<%s%D(%T, %T) <built-in>%>", msg, fn,
>> +	inform (cloc, "%s%<%D(%T, %T)%> <built-in>", msg, fn,
>>  		candidate->convs[0]->type,
>>  		candidate->convs[1]->type);
>>        else
>> -	inform (cloc, "%<%s%D(%T) <built-in>%>", msg, fn,
>> +	inform (cloc, "%s%<%D(%T)%> <built-in>", msg, fn,
>>  		candidate->convs[0]->type);
>>      }
>>    else if (TYPE_P (fn))
>> ===================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-07 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-06 23:55 [PATCH] PR80280: Fix quoting of candidate functions Volker Reichelt
2017-05-07 19:23 ` Martin Sebor
2017-05-07 20:03   ` Volker Reichelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).