This is the mail archive of the gcc@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]

Re: Request for a compiler feature


"Ross Smith" <ross.s@ihug.co.nz> writes:

> Suggestion: Emit the typedefs separately from the main error message.
> Something like this:
> 
>   foo.cpp:123: Error: MyMapType and MyOtherMapType are incompatible
>   foo.cpp:123: MyMapType is typedef for std::pair<Key, const Value>
>   foo.cpp:123: MyOtherMapType is typedef for std::pair<Key, Value>
> 
> That gives you the clearer error messages in the common cases where the
> types involved are complicated template instantiations (e.g.
> std::string) but the details aren't relevant, but if you need to you can
> still check that the types are what you thought they were.

That would still confuse the error message listing a lot, because STL
typedefs are often over several lines. I think this case is special enough
that it could be turned on by a separate switch, with the default to off. 
To make it clear gcc could tell the user about it on the first encounter
of a typedef in a message. 

foo.cpp:123: Error: MyMapType and MyOtherMapType are incompatible
foo.cpp:123: Typedef not expanded, use -Wexpand-typedef to change. 

A -W prefix is not really 100% right, but seems to be the best option 
here. 


-A.


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