This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12357] Fails to find overload (or maybe very bad error message)


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at gcc dot gnu dot
                   |                            |org


------- Additional Comments From bangerth at dealii dot org  2003-09-22 14:16 -------
I think what is happening is a case of substitution failure is not an
error, and in that case gcc would be right (icc rejects the code as well,
by the way): if you don't specify the third argument, the compiler needs
to figure out its type through the default argument. However, there is
no single operator< (there are some built-in functions), so taking the
address is not a unique operation and type unification fails. This
is a substitution failure, and the template is thus not considered for
overload resolution. But since it is the only function by that name,
there is no match for the given argument list.

Ivan, can you state why you think this should compile?

Now, with present mainline, we get the following error:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc:4: error: `operator<' not defined
x.cc:4: error: `operator<' not defined
x.cc: In function `int main()':
x.cc:13: error: no matching function for call to `Lss(int, int)'

Note a) the doubled error message, and b) that we seem to be parsing
the default argument already before instantiation. I don't know whether
that is supposed to happen.

Nathan, you volunteered to review the tricky cases. Can you say something
about a) the validity of the testcase, and b) whether 3.4 is doing the
right thing with the default argument?

W.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]