error message formatting
Mark Mitchell
mmitchell@usa.net
Thu Apr 16 23:59:00 GMT 1998
>>>>> "Alexandre" == Alexandre Oliva <oliva@dcc.unicamp.br> writes:
Alexandre> Mark Mitchell writes:
>> We have to be careful that we don't introduce ambiguity in the
>> process. It may be possible to do so by dropping defaulted
>> arguments,
>> template <class T, class U = T**> void f();
>> template <class T*, class U = T*> void f();
Alexandre> `classs T*' is not a valid template argument
Alexandre> declaration.
Thank you for the improved example. I *knew* when I wrote what I did
that I didn't have it right, but I didn't have time to think about it
carefully. What an embarrassing mistake!
Alexandre> However, the raised issue is a valid one. Suppose one
Alexandre> declares:
Alexandre> template <typename T, int i = 1> void f(); template
Alexandre> <typename T, char e = '\0'> void f();
Alexandre> Then he calls f<int>(). The compiler must report an
Alexandre> ambiguity but, if we remove trailing default arguments,
Alexandre> the error message would look like:
Alexandre> ?:?:Template function call is ambiguous. Available
Alexandre> specializations are: ?:?: f<int>() ?:?: f<int>()
Alexandre> This would seem rather confusing, although line numbers
Alexandre> might help.
Alexandre> -- Alexandre Oliva mailto:oliva@dcc.unicamp.br
Alexandre> mailto:aoliva@acm.org http://www.dcc.unicamp.br/~oliva
Alexandre> Universidade Estadual de Campinas, SP, Brasil
--
Mark Mitchell <mmitchell@usa.net>
http://home.earthlink.net/~mbmitchell
Consulting Services Available
More information about the Gcc
mailing list