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.reich...@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))
===================================================================


Reply via email to