error message formatting
Lassi A. Tuura
lat@iki.fi
Tue Apr 21 17:06:00 GMT 1998
Joe Buck wrote:
|> One possibility would be to suppress template arguments when they match
|> the default. We then have
|>
|> > fxg_glyph_mgr.cc:345: no matching function for call to `map<int,list<FXG_Glyph *> *>::insert (__rb_tree_iterator<pair<const int,list<FXG_Glyph *> *>,pair<const int,list<FXG_Glyph *> *> &,pair<const int,list<FXG_Glyph *> *> *> &, list<FXG_Glyph *> *&)'
|> > /usr/local/egcs/include/g++/stl_map.h:139: candidates are: map<int,list<FXG_Glyph *> *>::insert(__rb_tree_iterator<pair<const int,list<FXG_Glyph *> *>,pair<const int,list<FXG_Glyph *> *> &,pair<const int,list<FXG_Glyph *> *> *>, const pair<const int,list<FXG_Glyph *> *> &)
|> > /usr/local/egcs/include/g++/stl_map.h:138: map<int,list<FXG_Glyph *> *>::insert(const pair<const int,list<FXG_Glyph *> *> &)>
How about something like this?
...: no matching function for call to map<T1,T2>::insert (__rb_tree_iterator<T3,T3 &,T3 *> &,T2 &)'
...: candidates are: map<T1,T2>::insert (__rb_tree_iterator<T3,T3 &,T3 *>, const T3 &)
...: map<T1,T2>::insert (const T3 &)
...: (where T1=int, T2=list<FCG_Glyph *> *, T3=pair<const T1,T2>)
The generation of such messages should be relatively straightforward:
during the message generation, keep track of all types seen template
arguments and substitute as many as you can, but not creating new types
for cv-qualified and pointer-decorated versions. The results are, IMHO,
as readable as they can get. One could still fiddle with showing the
actual declared function parameter types (map<T1,T2>::iterator instead
of __rb_tree_iterator in this case) for improved clarity (is that
information still available?).
With this scheme templates with lots of arguments would still be at
least somewhat readable. Hence, there would not be such a need to
supporess default arguments. For instance, map would really be
`map<T1,T2,T3,T4>', where at the end of error messages `T3' would be
shown as `less<T1>' and `T4' as `allocator<T2>' (or whatever user
substituted).
Cheers,
//lat
--
Every old idea will be proposed again with a different name and a
different presentation, regardless of whether it works. --RFC1925
More information about the Gcc
mailing list