[Bug c++/16057] Error message omits overload candidate
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Fri Jun 18 14:52:00 GMT 2004
------- Additional Comments From bangerth at dealii dot org 2004-06-18 14:52 -------
Confirmed. Here is some code:
----------------
void endl (int);
void endl (double);
struct A {};
void operator << (A &, int);
template<typename U>
void operator << (A &, U);
int main() {
A* e;
*e << endl;
}
---------------------
Note that 'endl' is the set of overloads; this would be alright if we
could find a function that picks a single element from this set of
overloads by a suitable type for the second argument, but we don't
have such a function. Instead, we get this:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -w -c x.cc
x.cc: In function `int main()':
x.cc:13: error: no match for 'operator<<' in '*e << endl'
x.cc:6: note: candidates are: void operator<<(A&, int)
Indeed, only one of the overloads of operator<< is listed. Now, one
could argue that this isn't even a bug: the second, templated overload,
is unable to pick among the overload set, so it can't possibly be a
candidate anyway, but this is a rather narrow interpretation. I would
concede that it may make sense to list all operator<< overloads here.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-06-18 14:52:28
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16057
More information about the Gcc-bugs
mailing list