public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53822] New: Diagnostic: spell out type in ambiguous call
@ 2012-06-30 16:57 glisse at gcc dot gnu.org
  2012-06-30 16:59 ` [Bug c++/53822] " glisse at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-06-30 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53822
           Summary: Diagnostic: spell out type in ambiguous call
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org


Hello,

void f(float);
void f(double);
int main(){
  typedef unsigned NT;
  NT i=3;
  f(i);
}

mp.cc: In function ‘int main()’:
mp.cc:6:6: error: call of overloaded ‘f(NT&)’ is ambiguous
mp.cc:6:6: note: candidates are:
mp.cc:1:6: note: void f(float)
mp.cc:2:6: note: void f(double)

Notice that the error message never mentions "unsigned". In the middle of some
deep templated code, finding out what the problematic NT is can be hard.


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

* [Bug c++/53822] Diagnostic: spell out type in ambiguous call
  2012-06-30 16:57 [Bug c++/53822] New: Diagnostic: spell out type in ambiguous call glisse at gcc dot gnu.org
@ 2012-06-30 16:59 ` glisse at gcc dot gnu.org
  2013-04-19 15:27 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-06-30 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> 2012-06-30 16:59:13 UTC ---
Hmm, the true message from 4.8, not 4.7 this time:

mp.cc: In function 'int main()':
mp.cc:6:6: error: call of overloaded 'f(NT&)' is ambiguous
   f(i);
      ^
mp.cc:6:6: note: candidates are:
mp.cc:1:6: note: void f(float)
 void f(float);
      ^
mp.cc:2:6: note: void f(double)
 void f(double);
      ^


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

* [Bug c++/53822] Diagnostic: spell out type in ambiguous call
  2012-06-30 16:57 [Bug c++/53822] New: Diagnostic: spell out type in ambiguous call glisse at gcc dot gnu.org
  2012-06-30 16:59 ` [Bug c++/53822] " glisse at gcc dot gnu.org
@ 2013-04-19 15:27 ` paolo.carlini at oracle dot com
  2014-01-02 21:23 ` [Bug c++/53822] spell out typedefs " glisse at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-19 15:27 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-19 15:27:28 UTC ---
Makes sense to me and must be pretty easy to implement.


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

* [Bug c++/53822] spell out typedefs in ambiguous call
  2012-06-30 16:57 [Bug c++/53822] New: Diagnostic: spell out type in ambiguous call glisse at gcc dot gnu.org
  2012-06-30 16:59 ` [Bug c++/53822] " glisse at gcc dot gnu.org
  2013-04-19 15:27 ` paolo.carlini at oracle dot com
@ 2014-01-02 21:23 ` glisse at gcc dot gnu.org
  2014-01-02 23:05 ` manu at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-01-02 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
Created attachment 31564
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31564&action=edit
patch

(mostly untested)

This changes the message to:
error: call of overloaded 'f(NT&)' {aka 'f(unsigned int&)'} is ambiguous

As far as I can tell, "%#A" is unused, so it seems ok to hijack it.

It isn't very nice because without typedefs it will repeat the same thing
twice, but printing [with NT=unsigned int] seems more complicated to me.

Then maybe the example is not that well chosen, because in the more interesting
cases NT depends on template parameters, and that may make [with ...] easier to
implement (or not).


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

* [Bug c++/53822] spell out typedefs in ambiguous call
  2012-06-30 16:57 [Bug c++/53822] New: Diagnostic: spell out type in ambiguous call glisse at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-01-02 21:23 ` [Bug c++/53822] spell out typedefs " glisse at gcc dot gnu.org
@ 2014-01-02 23:05 ` manu at gcc dot gnu.org
  2014-01-03 11:56 ` manu at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2014-01-02 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #4)
> Created attachment 31564 [details]
> patch
> 
> (mostly untested)
> 
> This changes the message to:
> error: call of overloaded 'f(NT&)' {aka 'f(unsigned int&)'} is ambiguous
> 
> As far as I can tell, "%#A" is unused, so it seems ok to hijack it.
> 
> It isn't very nice because without typedefs it will repeat the same thing
> twice, but printing [with NT=unsigned int] seems more complicated to me.

There is code in error.c:type_to_string to print "{aka ". It does some tricks
to avoid printing aka when there are no typedefs. Perhaps args_to_string()
should call type_to_string() instead of calling dump_type directly. With that,
it prints:


test.cc:6:6: error: call of overloaded ‘f(NT& {aka unsigned int&})’ is
ambiguous

I am not sure if that is clearer or not. But it avoids the repetition.
>From gcc-bugs-return-438949-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jan 02 23:12:48 2014
Return-Path: <gcc-bugs-return-438949-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7458 invoked by alias); 2 Jan 2014 23:12:47 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 7405 invoked by uid 48); 2 Jan 2014 23:12:42 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/53822] spell out typedefs in ambiguous call
Date: Thu, 02 Jan 2014 23:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-53822-4-6eAuLIqYil@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-53822-4@http.gcc.gnu.org/bugzilla/>
References: <bug-53822-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg00091.txt.bz2
Content-length: 906

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

--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #5)
> (In reply to Marc Glisse from comment #4)
> There is code in error.c:type_to_string to print "{aka ". It does some
> tricks to avoid printing aka when there are no typedefs. Perhaps
> args_to_string() should call type_to_string() instead of calling dump_type
> directly. With that, it prints:
> 
> test.cc:6:6: error: call of overloaded ‘f(NT& {aka unsigned int&})’ is
> ambiguous

Nice!

> I am not sure if that is clearer or not.

Probably depends on cases. Sometimes it is good to have the explanation right
next to the type, other times it takes up all the space and you can't even find
the commas separating the arguments anymore (maybe if the whole {aka ...} block
was a different color?).
>From gcc-bugs-return-438950-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jan 02 23:45:59 2014
Return-Path: <gcc-bugs-return-438950-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18804 invoked by alias); 2 Jan 2014 23:45:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 18745 invoked by uid 48); 2 Jan 2014 23:45:54 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/54570] [4.8 Regression] FAIL: gcc.dg/builtin-object-size-8.c execution test
Date: Thu, 02 Jan 2014 23:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-54570-4-Gk5ZgiAugc@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-54570-4@http.gcc.gnu.org/bugzilla/>
References: <bug-54570-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg00092.txt.bz2
Content-length: 159

http://gcc.gnu.org/bugzilla/show_bug.cgi?idT570

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, this fix had PR59362 as follow-up.


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

* [Bug c++/53822] spell out typedefs in ambiguous call
  2012-06-30 16:57 [Bug c++/53822] New: Diagnostic: spell out type in ambiguous call glisse at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-01-02 23:05 ` manu at gcc dot gnu.org
@ 2014-01-03 11:56 ` manu at gcc dot gnu.org
  2021-08-10  0:11 ` pinskia at gcc dot gnu.org
  2021-08-10  0:11 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2014-01-03 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #6)
> Probably depends on cases. Sometimes it is good to have the explanation
> right next to the type, other times it takes up all the space and you can't
> even find the commas separating the arguments anymore (maybe if the whole
> {aka ...} block was a different color?).

That could be possible. On the other hand, the "{aka ...}" thing is not really
ideal (in general). Currently,

1) It is not translated
2) You need to know what "aka" means (not obvious relation with 'typedef')
3) It is not correctly quoted, that is, instead of "`NT {aka int}'", we should
print "`NT' {aka `int'}".
4) The "aka" should not be colored in the same way as the types. Fixing the
quoting will fix this.
5) Complex declarations lead to many repetitions of "aka": "`f(NT {aka int},UT
{aka unsigned int},DT {aka double int})'".
>From gcc-bugs-return-438983-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jan 03 12:22:54 2014
Return-Path: <gcc-bugs-return-438983-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3969 invoked by alias); 3 Jan 2014 12:22:54 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 3949 invoked by uid 48); 3 Jan 2014 12:22:50 -0000
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/59252] wrong code generation for allocatable character component
Date: Fri, 03 Jan 2014 12:22:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.8.2
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: janus at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: keywords cc short_desc
Message-ID: <bug-59252-4-Pwf64lQmnt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59252-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59252-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg00125.txt.bz2
Content-length: 848

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY252

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |janus at gcc dot gnu.org
            Summary|wrong code generation for   |wrong code generation for
                   |allocatable dummy arguments |allocatable character
                   |                            |component

--- Comment #2 from janus at gcc dot gnu.org ---
Unrelated to dummy arguments. Reduced test case:


  implicit none

  type branch_plot_results_ppv_type
     character, allocatable :: label
  end type

  type(branch_plot_results_ppv_type), allocatable :: appv(:)

  allocate(appv(2))

end


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

* [Bug c++/53822] spell out typedefs in ambiguous call
  2012-06-30 16:57 [Bug c++/53822] New: Diagnostic: spell out type in ambiguous call glisse at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-01-03 11:56 ` manu at gcc dot gnu.org
@ 2021-08-10  0:11 ` pinskia at gcc dot gnu.org
  2021-08-10  0:11 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-10  0:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2013-04-16 00:00:00         |2021-8-9

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang does not even print out the argument type :).
NOTE that is actually worse.
ICC and MSVC both print out the typedef name.

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

* [Bug c++/53822] spell out typedefs in ambiguous call
  2012-06-30 16:57 [Bug c++/53822] New: Diagnostic: spell out type in ambiguous call glisse at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-08-10  0:11 ` pinskia at gcc dot gnu.org
@ 2021-08-10  0:11 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-10  0:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

end of thread, other threads:[~2021-08-10  0:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-30 16:57 [Bug c++/53822] New: Diagnostic: spell out type in ambiguous call glisse at gcc dot gnu.org
2012-06-30 16:59 ` [Bug c++/53822] " glisse at gcc dot gnu.org
2013-04-19 15:27 ` paolo.carlini at oracle dot com
2014-01-02 21:23 ` [Bug c++/53822] spell out typedefs " glisse at gcc dot gnu.org
2014-01-02 23:05 ` manu at gcc dot gnu.org
2014-01-03 11:56 ` manu at gcc dot gnu.org
2021-08-10  0:11 ` pinskia at gcc dot gnu.org
2021-08-10  0:11 ` pinskia at gcc dot gnu.org

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