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

Reply via email to