http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54588
Bug #: 54588
Summary: Improved error messages by dropping out types
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Hi,
This is a suggestion for a new kind of error reporting in g++, to improve the
usability of g++ with template-heavy programming. The idea is summarized as
Do not report any type information; report in terms of objects.
Motivation
----------
The currently emitted error-messages are unacceptable because
* a single error, such as a missing conversion between types, may result in
hundreds of lines of error message, and
* it is hard to sift out the error-type and error-location from that message
(the main content of the error-message).
Experience in template programming shows that the specific root of the problem
lies in the abundance of reported type-information. Paradoxically, that
type-information normally has a very low information-density for the
programmer. While sometimes that information is needed, most of the time it
isn't.
Example
-------
A<VeryComplicatedType> a;
int b = a;
Current:
test.cpp:9:10: error: cannot convert 'A<VeryComplicatedType>' to 'int' in
initialization.
Suggested:
test.cpp:9:10: error: cannot convert 'a' to 'b' in initialization.
Here one should imagine, for the readability of this post, some 500+
character-type in place of the VeryComplicatedType, and possibly additional
such template parameters for A. Note that no type-information is reported, and
that errors are reported in terms of objects.
Conclusion
----------
Currently, the emitted error-messages report a maximal amount of information.
This post suggests to make available a new option to report a minimal amount of
information by not reporting type-information, and to report in terms of
objects instead.
Kalle