public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments
@ 2012-04-28  6:38 zeratul976 at hotmail dot com
  2012-04-28  7:26 ` [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zeratul976 at hotmail dot com @ 2012-04-28  6:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53152

             Bug #: 53152
           Summary: In "no match for operatorXX" error message, mention
                    the types of the arguments
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zeratul976@hotmail.com


Consider the following code:

struct T {};

struct S
{
    T foo();
};

int main()
{
    S a, b;
    a.foo() == b.foo();
}


The error message is:

error: no match for 'operator==' in 'a.S::foo() == b.S::foo()'


Notice the error doesn't mention 'T' anywhere. It would be nice if it did,
because in the general case the arguments passed to the operator could be
arbitrarily complex expressions, and working out their type manually can be
tedious.


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

* [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info
  2012-04-28  6:38 [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments zeratul976 at hotmail dot com
@ 2012-04-28  7:26 ` pinskia at gcc dot gnu.org
  2012-04-28 19:55 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-04-28  7:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53152

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2012-04-28
     Ever Confirmed|0                           |1
            Summary|In "no match for            |In "no match for
                   |operatorXX" error message,  |operatorXX" error message
                   |mention the types of the    |gives the wrong column info
                   |arguments                   |
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-04-28 07:25:33 UTC ---
The trunk already does:
t.cc: In function ‘int main()’:
t.cc:11:21: error: no match for ‘operator==’ (operand types are ‘T’ and ‘T’)
    a.foo() == b.foo();
                     ^
Tough we don't point at == but the call to b.foo() which seems wrong.

So confirmed about the wrong column info.


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

* [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info
  2012-04-28  6:38 [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments zeratul976 at hotmail dot com
  2012-04-28  7:26 ` [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info pinskia at gcc dot gnu.org
@ 2012-04-28 19:55 ` redi at gcc dot gnu.org
  2012-05-04 10:57 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-28 19:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53152

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-28 19:54:51 UTC ---
printing the types was basically PR 49152


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

* [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info
  2012-04-28  6:38 [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments zeratul976 at hotmail dot com
  2012-04-28  7:26 ` [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info pinskia at gcc dot gnu.org
  2012-04-28 19:55 ` redi at gcc dot gnu.org
@ 2012-05-04 10:57 ` paolo.carlini at oracle dot com
  2012-05-04 11:27 ` manu at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-04 10:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53152

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lopezibanez at gmail dot
                   |                            |com

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-04 10:57:11 UTC ---
How could we in principle fix this? Pass down from cp_parser_binary_expression
the location of the operator token, through build_x_binary_op -> build_new_op
-> build_new_op_1 -> op_error? Boring but straightforward. Or something else
entirely? I'm just guessing, really.


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

* [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info
  2012-04-28  6:38 [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments zeratul976 at hotmail dot com
                   ` (2 preceding siblings ...)
  2012-05-04 10:57 ` paolo.carlini at oracle dot com
@ 2012-05-04 11:27 ` manu at gcc dot gnu.org
  2012-05-04 12:31 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-04 11:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53152

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|lopezibanez at gmail dot    |manu at gcc dot gnu.org
                   |com                         |

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-04 11:27:15 UTC ---
(In reply to comment #3)
> How could we in principle fix this? Pass down from cp_parser_binary_expression
> the location of the operator token, through build_x_binary_op -> build_new_op
> -> build_new_op_1 -> op_error? Boring but straightforward. Or something else
> entirely? I'm just guessing, really.

Since we don't pass down the expression itself, I don't see any other way than
passing down the location. In general almost all build_* function should be
build_*(location_t loc,...). Thanks for doing this, it will improve the caret a
lot (and perhaps the debugging experience).


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

* [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info
  2012-04-28  6:38 [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments zeratul976 at hotmail dot com
                   ` (3 preceding siblings ...)
  2012-05-04 11:27 ` manu at gcc dot gnu.org
@ 2012-05-04 12:31 ` paolo.carlini at oracle dot com
  2012-05-04 12:32 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-04 12:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53152

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-04 12:30:37 UTC ---
Ok, let's do this. I'm attaching a proof-of-concept patch.


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

* [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info
  2012-04-28  6:38 [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments zeratul976 at hotmail dot com
                   ` (4 preceding siblings ...)
  2012-05-04 12:31 ` paolo.carlini at oracle dot com
@ 2012-05-04 12:32 ` paolo.carlini at oracle dot com
  2012-05-06 15:07 ` paolo at gcc dot gnu.org
  2012-05-06 15:40 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-04 12:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53152

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-04 12:31:23 UTC ---
Created attachment 27306
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27306
POC


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

* [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info
  2012-04-28  6:38 [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments zeratul976 at hotmail dot com
                   ` (5 preceding siblings ...)
  2012-05-04 12:32 ` paolo.carlini at oracle dot com
@ 2012-05-06 15:07 ` paolo at gcc dot gnu.org
  2012-05-06 15:40 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-05-06 15:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53152

--- Comment #7 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-05-06 15:06:35 UTC ---
Author: paolo
Date: Sun May  6 15:06:31 2012
New Revision: 187211

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187211
Log:
2012-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/53152
    * call.c (op_error, build_new_op_1, build_new_op): Add location_t
    parameter.
    (build_conditional_expr_1): Adjust.
    * typeck.c (build_x_indirect_ref, build_x_binary_op,
    build_x_unary_op): Add location_t parameter.
    (rationalize_conditional_expr, build_x_array_ref,
    build_x_compound_expr, cp_build_modify_expr, build_x_modify_expr):
    Adjust.
    * typeck2.c (build_x_arrow): Add location_t parameter.
    * semantics.c (finish_unary_op_expr): Likewise.
    (finish_increment_expr, handle_omp_for_class_iterator): Adjust.
    * decl2.c (grok_array_decl): Add location_t parameter.
    * parser.c (cp_parser_postfix_open_square_expression,
    cp_parser_postfix_dot_deref_expression, cp_parser_unary_expression,
    cp_parser_binary_expression, cp_parser_builtin_offsetof,
    do_range_for_auto_deduction, cp_convert_range_for,
    cp_parser_template_argument, cp_parser_omp_for_cond): Pass the
    location, adjust.
    * pt.c (tsubst_copy_and_build): Adjust.
    * tree.c (maybe_dummy_object): Likewise.
    * cp-tree.h: Update declarations.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/cp/tree.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/cp/typeck2.c


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

* [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info
  2012-04-28  6:38 [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments zeratul976 at hotmail dot com
                   ` (6 preceding siblings ...)
  2012-05-06 15:07 ` paolo at gcc dot gnu.org
@ 2012-05-06 15:40 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-06 15:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53152

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-06 15:09:02 UTC ---
Done.


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

end of thread, other threads:[~2012-05-06 15:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-28  6:38 [Bug c++/53152] New: In "no match for operatorXX" error message, mention the types of the arguments zeratul976 at hotmail dot com
2012-04-28  7:26 ` [Bug c++/53152] In "no match for operatorXX" error message gives the wrong column info pinskia at gcc dot gnu.org
2012-04-28 19:55 ` redi at gcc dot gnu.org
2012-05-04 10:57 ` paolo.carlini at oracle dot com
2012-05-04 11:27 ` manu at gcc dot gnu.org
2012-05-04 12:31 ` paolo.carlini at oracle dot com
2012-05-04 12:32 ` paolo.carlini at oracle dot com
2012-05-06 15:07 ` paolo at gcc dot gnu.org
2012-05-06 15:40 ` paolo.carlini at oracle dot com

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).