public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads
       [not found] <bug-17166-4@http.gcc.gnu.org/bugzilla/>
@ 2013-06-21 14:49 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-21 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|gcc-bugs at gcc dot gnu.org        |
      Known to work|                            |4.8.0, 4.9.0
         Resolution|---                         |FIXED

--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Lately the diagnostic is good.


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

* [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads
       [not found] <bug-17166-7904@http.gcc.gnu.org/bugzilla/>
@ 2005-11-25  8:31 ` guillaume dot melquiond at ens-lyon dot fr
  0 siblings, 0 replies; 6+ messages in thread
From: guillaume dot melquiond at ens-lyon dot fr @ 2005-11-25  8:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from guillaume dot melquiond at ens-lyon dot fr  2005-11-25 08:31 -------
Your testcases are too minimal. The issue lies in the diagnostic, when there is
a compilation error involving an anonymous enumeration. In the original
bug-report, GCC was trying to delete a file instead of removing a vector range.
Since the code was using a common STL idiom, it was really puzzling.

So the minimal testcase is imo this one:

struct A {};
int foo(A);
template <typename T> int foo(void *, T);
enum {e};
int i = foo(0, e);

GCC silently ignores the usually-match-anything template function and it tries
to use instead another function. Please note that this other function does not
even have the correct number of arguments! This is the error message of GCC
3.4.5 and 4.0.2:

error: conversion from 'int' to non-scalar type 'A' requested

With a snapshot of GCC 4.1, the error message is a bit better, since GCC now
gives the signatures instead of simply telling it tried to use a function of
the wrong arity:

error: no matching function for call to 'foo(int, <anonymous enum>)'
note: candidates are: int foo(A)

In particular, GCC 4.1 explicitly displays "<anonymous enum>" now. I am not
sure it is clear enough for the casual user, but at least for me it is.


-- 


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


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

* [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads
  2004-08-24 12:41 [Bug c++/17166] New: g++ 3.4.1 and 3.5 forget a template function definition guillaume dot melquiond at ens-lyon dot fr
                   ` (2 preceding siblings ...)
  2005-05-29 16:21 ` pinskia at gcc dot gnu dot org
@ 2005-05-29 20:45 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-29 20:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-29 20:37 -------
*** Bug 21808 has been marked as a duplicate of this bug. ***

-- 


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


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

* [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads
  2004-08-24 12:41 [Bug c++/17166] New: g++ 3.4.1 and 3.5 forget a template function definition guillaume dot melquiond at ens-lyon dot fr
  2004-10-28  3:58 ` [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads giovannibajo at libero dot it
  2005-05-29 16:03 ` pinskia at gcc dot gnu dot org
@ 2005-05-29 16:21 ` pinskia at gcc dot gnu dot org
  2005-05-29 20:45 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-29 16:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-29 16:02 -------
*** Bug 21808 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |veksler at il dot ibm dot
                   |                            |com


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


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

* [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads
  2004-08-24 12:41 [Bug c++/17166] New: g++ 3.4.1 and 3.5 forget a template function definition guillaume dot melquiond at ens-lyon dot fr
  2004-10-28  3:58 ` [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads giovannibajo at libero dot it
@ 2005-05-29 16:03 ` pinskia at gcc dot gnu dot org
  2005-05-29 16:21 ` pinskia at gcc dot gnu dot org
  2005-05-29 20:45 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-29 16:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-29 16:02 -------
The testcase really boils down to:
template <typename T> int foo ();
int i = foo(1);


OR

template <typename T> struct f{};
template <typename T> int foo (f<T>);
int i = foo(1);


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-10-28 03:58:46         |2005-05-29 16:02:02
               date|                            |


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


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

* [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads
  2004-08-24 12:41 [Bug c++/17166] New: g++ 3.4.1 and 3.5 forget a template function definition guillaume dot melquiond at ens-lyon dot fr
@ 2004-10-28  3:58 ` giovannibajo at libero dot it
  2005-05-29 16:03 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-28  3:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-10-28 03:58 -------
No, this is not a substitution failure, but rather a deduction failure. We 
cannot deduce the enum from the function call because it is not a valid non-
type template parameter.

What is questionable here is the error message GCC produce. I have been 
wondering for a while what is the best solution -- to me, it looks like we 
should always list the overloads we rejects, with a brief motivation of why 
they got rejected. I guess this would help tremendously.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-28 03:58:46
               date|                            |
            Summary|g++ 3.4.1 and 3.5 forget a  |Improve diagnostic for empty
                   |template function definition|overload set listing the
                   |                            |rejected overloads


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


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

end of thread, other threads:[~2013-06-21 14:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-17166-4@http.gcc.gnu.org/bugzilla/>
2013-06-21 14:49 ` [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads paolo.carlini at oracle dot com
     [not found] <bug-17166-7904@http.gcc.gnu.org/bugzilla/>
2005-11-25  8:31 ` guillaume dot melquiond at ens-lyon dot fr
2004-08-24 12:41 [Bug c++/17166] New: g++ 3.4.1 and 3.5 forget a template function definition guillaume dot melquiond at ens-lyon dot fr
2004-10-28  3:58 ` [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads giovannibajo at libero dot it
2005-05-29 16:03 ` pinskia at gcc dot gnu dot org
2005-05-29 16:21 ` pinskia at gcc dot gnu dot org
2005-05-29 20:45 ` pinskia at gcc dot gnu dot 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).