https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52288

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-06
            Summary|Trouble with operator?: and |operator?: and lambdas
                   |lambdas                     |error message could be
                   |                            |better

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #6)
> G++ will now say
> 
> wa.C:3:17: error: operands to ?: have different types ‘main(int,
> char**)::<lambda(int)>’ and ‘main(int, char**)::<lambda(int)>’
> 
> I think that addresses the ?: part of this issue.  I'll leave it open for
> now in case we want to keep it as a question about how to name lambdas in
> error messages.  It seems to me that we might want to omit the function
> scope if we're currently in the same function.  Do we want to give them
> numbers to distinguish them?

This is how clang does their names of the lambdas in error message:
<source>:4:17: error: incompatible operand types ('(lambda at <source>:4:19)'
and '(lambda at <source>:5:9)')
    void* p = b ? [argc](int i){ return i; } :
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~

Maybe we can do the same.

Reply via email to